/* Vimox Router 用户门户样式（自包含，无外部依赖）。 */

:root {
  color-scheme: light;
  --bg: #faf9f6;
  --surface: #fffefa;
  --surface-2: #f1efe8;
  --border: #e4e0d5;
  --text: #292d27;
  --text-2: #646a5f;
  --text-3: #74796d;
  --accent: #916b2d;
  --accent-soft: rgba(145, 107, 45, 0.09);
  --hero-bg: #f2f0e9;
  --grid-line: rgba(68, 75, 53, .035);
  --shadow: 0 8px 28px rgba(47, 42, 27, .035);
  --ok: #10b981;
  --warn: #f59e0b;
  --danger: #ef4444;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171914;
  --surface: #20231d;
  --surface-2: #292d25;
  --border: #373d31;
  --text: #eeeee5;
  --text-2: #b7bcac;
  --text-3: #a0a791;
  --accent: #d5b578;
  --accent-soft: rgba(213, 181, 120, 0.12);
  --hero-bg: #1c2019;
  --grid-line: rgba(190, 200, 169, .04);
  --shadow: 0 8px 28px rgba(0, 0, 0, .1);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.6 -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.hidden { display: none !important; }
.portal-skeleton-line,
.portal-loading-row span { display: block; border-radius: 999px; background: linear-gradient(100deg, var(--surface-2) 20%, #e5e8ef 42%, var(--surface-2) 64%); background-size: 220% 100%; animation: portal-loading-shimmer 1.35s ease-in-out infinite; }
[data-theme="dark"] .portal-skeleton-line,
[data-theme="dark"] .portal-loading-row span { background: linear-gradient(100deg, var(--surface-2) 20%, #343842 42%, var(--surface-2) 64%); background-size: 220% 100%; }
.portal-skeleton-ring { width: 104px; height: 104px; margin: 8px auto; border: 10px solid var(--surface-2); border-right-color: var(--border); border-radius: 50%; animation: portal-skeleton-spin 2.2s linear infinite; }
.portal-skeleton-active svg { visibility: hidden; }
.portal-skeleton-active::after { content: ""; position: absolute; inset: 8px; margin: auto; width: 84px; height: 84px; border: 8px solid var(--surface-2); border-right-color: var(--border); border-radius: 50%; animation: portal-skeleton-spin 2.2s linear infinite; }
.portal-skeleton-value { width: 46%; height: 25px; margin: 10px 0; }
.portal-skeleton-detail { width: 92%; height: 10px; margin: 7px 0; }
.portal-skeleton-detail.short { width: 62%; }
.portal-loading-row td { height: 42px; padding: 9px 12px; }
.portal-loading-row span { height: 10px; width: 76%; }
.portal-loading-row td:nth-child(2n) span { width: 55%; }
.portal-loading-row td:nth-child(3n) span { width: 88%; }
.portal-loading-message { min-height: 160px; display: grid; place-items: center; color: var(--text-3); }
.portal-content-skeleton { display: grid; gap: 9px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.portal-content-skeleton-row { display: grid; grid-template-columns: minmax(80px, 1fr) minmax(140px, 2fr); gap: 16px; align-items: center; min-height: 30px; border-bottom: 1px solid var(--border); }
.portal-content-skeleton-row:last-child { border-bottom: 0; }
.portal-stat-skeleton { display: grid; gap: 8px; }
.portal-stat-skeleton .portal-skeleton-line { display: block; }
.portal-stat-skeleton .portal-skeleton-value { margin: 0; }
.portal-loading .cards > .card { min-height: 164px; }
.portal-loading .cards > .quota-card { min-height: 284px; }
@media (max-width: 760px) {
  .portal-loading .cards { gap: 10px; }
  .portal-loading .cards > .card { min-height: 138px; }
  .portal-loading .cards > .quota-card { min-height: 228px; }
  .portal-loading .quota-ring-wrap { width: 96px; height: 96px; }
  .portal-loading .portal-skeleton-active::after { width: 72px; height: 72px; border-width: 7px; }
}
@media (prefers-reduced-motion: reduce) {
  .portal-skeleton-line, .portal-loading-row span, .portal-skeleton-ring, .skeleton-line { animation-duration: 3s; }
}
@keyframes portal-loading-shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
@keyframes portal-skeleton-spin { to { transform: rotate(360deg); } }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--text-3); }
code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

/* 顶栏 */
.topbar { border-bottom: 1px solid var(--border); background: var(--surface); position: sticky; top: 0; z-index: 10; }
.topbar-inner { width: 100%; padding: 16px clamp(20px, 3vw, 64px); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; }
.brand { color: inherit; text-decoration: none; cursor: pointer; }
.brand:hover { color: var(--accent); }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.brand-sub { color: var(--text-3); font-weight: 400; font-size: 13px; }
.topbar-actions { display: flex; gap: 8px; align-items: center; }
.announcement-trigger { position: relative; gap: 7px; }
.announcement-bell { font-size: 15px; line-height: 1; }
.announcement-unread { display: inline-grid; min-width: 19px; height: 19px; place-items: center; padding: 0 5px; border: 2px solid var(--surface); border-radius: 999px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.announcement-trigger.has-unread { color: var(--accent); }
.announcement-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(12, 14, 18, .46); backdrop-filter: blur(2px); }
#announcements-panel.announcement-panel { position: fixed !important; inset: 0 0 0 auto !important; z-index: 40; display: flex; flex-direction: column; width: min(480px, 100vw); height: 100dvh; max-height: 100vh; padding: 24px; overflow-y: auto; background: var(--surface); border: 0; border-left: 1px solid var(--border); box-shadow: -18px 0 56px rgba(0, 0, 0, .18); transform: translateX(102%); visibility: hidden; transition: transform .22s ease, visibility .22s; }
#announcements-panel.announcement-panel.is-open { transform: translateX(0); visibility: visible; }
.announcement-panel-head { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; margin: -4px 0 18px; padding-bottom: 15px; border-bottom: 1px solid var(--border); }
.announcement-panel-head h2 { margin: 0; font-size: 20px; letter-spacing: -.02em; }
.announcement-list { display: grid; gap: 12px; }
.announcement-item { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 12px; padding: 15px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); box-shadow: 0 3px 12px rgba(20, 25, 40, .04); }
.announcement-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--accent); background: var(--accent-soft); font-size: 20px; }
.announcement-copy { min-width: 0; }
.announcement-item-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.announcement-item-head strong { font-size: 14px; }
.announcement-item-head time { flex: none; color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.announcement-body { margin-top: 8px; color: var(--text-2); line-height: 1.7; overflow-wrap: anywhere; }
.announcement-body > :first-child { margin-top: 0; }
.announcement-body > :last-child { margin-bottom: 0; }
.announcement-body p { margin: .55em 0; }
.announcement-body h1, .announcement-body h2, .announcement-body h3, .announcement-body h4, .announcement-body h5, .announcement-body h6 { margin: .85em 0 .4em; color: var(--text); line-height: 1.35; }
.announcement-body h1 { font-size: 1.35em; }
.announcement-body h2 { font-size: 1.2em; }
.announcement-body h3, .announcement-body h4, .announcement-body h5, .announcement-body h6 { font-size: 1.05em; }
.announcement-body ul, .announcement-body ol { margin: .45em 0 .8em 1.5em; padding: 0; }
.announcement-body a { color: var(--accent); text-decoration: underline; }
.announcement-body code { padding: 2px 5px; border-radius: 4px; background: var(--surface-2); font-family: var(--mono); font-size: .92em; }
.announcement-body pre { margin: .7em 0 1em; padding: 13px 15px; overflow-x: auto; border-radius: 8px; background: var(--surface-2); color: var(--text); font: 12px/1.6 var(--mono); white-space: pre; }
.announcement-body table { width: 100%; border-collapse: collapse; font-size: 12px; }
.announcement-body th, .announcement-body td { padding: 7px 9px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.announcement-body th { background: var(--surface-2); color: var(--text); font-weight: 650; }
.announcement-body img { max-width: 100%; height: auto; border-radius: 8px; }
.announcement-empty { display: grid; min-height: 220px; place-items: center; padding: 36px 12px; color: var(--text-3); text-align: center; }

/* 按钮 */
.btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 7px 14px; font-size: 13px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn:disabled { cursor: not-allowed; opacity: .55; filter: none; }

/* 布局 */
.container { margin: 0; padding: 32px clamp(20px, 3vw, 64px) 56px; width: 100%; min-width: 0; flex: 1; }
.footer { border-top: 1px solid var(--border); padding: 14px 20px; text-align: center; color: var(--text-3); font-size: 12px; }

/* 登录区 */
.hero { text-align: center; margin: 48px 0 28px; }
.hero h1 { font-size: 26px; margin: 0 0 8px; }
.hero p { color: var(--text-2); margin: 0; }
.login-card { max-width: 560px; margin: 0 auto; }
.auth-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; border: 1px solid var(--border); border-radius: 10px; padding: 4px; background: var(--surface-2); margin-bottom: 16px; }
.auth-tabs button { border: none; background: transparent; color: var(--text-2); border-radius: 7px; height: 34px; font-size: 13px; cursor: pointer; }
.auth-tabs button.active { background: var(--surface); color: var(--accent); font-weight: 600; box-shadow: 0 1px 4px rgba(0, 0, 0, .06); }
.account-form { display: grid; gap: 12px; margin-bottom: 14px; }
.form-field { display: grid; gap: 5px; text-align: left; color: var(--text-2); font-size: 12px; }
.form-field input { width: 100%; height: 42px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font-size: 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
.form-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.code-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.code-row .btn { height: 42px; white-space: nowrap; }
.account-submit { height: 42px; justify-content: center; border-radius: 9px; }
.oauth-row { display: flex; justify-content: center; margin-bottom: 14px; }
.oauth-login-btn { width: 100%; height: 44px; justify-content: center; border-radius: 10px; }
.login-divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; margin: 14px 0; }
.login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.key-input-row { display: flex; gap: 10px; }
.key-input-wrap { position: relative; flex: 1; }
.key-input-wrap input { width: 100%; height: 44px; padding: 0 42px 0 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-family: var(--mono); font-size: 13px; outline: none; transition: border-color .15s, box-shadow .15s; }
.key-input-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.eye-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: none; background: transparent; cursor: pointer; color: var(--text-3); font-size: 15px; padding: 6px; }
.key-input-row .btn-primary { height: 44px; padding: 0 24px; border-radius: 10px; }
.login-error { color: var(--danger); text-align: center; margin: 10px 0 0; }
.privacy-note { color: var(--text-3); font-size: 12px; text-align: center; margin-top: 12px; }
.shake { animation: shake .35s; }
@keyframes shake { 20% { transform: translateX(-6px); } 45% { transform: translateX(5px); } 70% { transform: translateX(-3px); } 100% { transform: translateX(0); } }

/* 状态条 */
.status-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; }
.status-dot.inactive { background: var(--danger); }
@keyframes pulse { 50% { opacity: .45; } }
.key-title { font-weight: 600; font-size: 15px; }
.key-meta { color: var(--text-3); font-size: 12.5px; font-family: var(--mono); }
.spacer { flex: 1; }

/* 告警条 */
.alert { border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.alert-danger { background: rgba(239, 68, 68, .1); color: var(--danger); border: 1px solid rgba(239, 68, 68, .3); }
.alert-link { color: inherit; font-weight: 600; margin-left: 8px; }

/* 概览卡片 */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 22px; }
@media (max-width: 760px) { .cards { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
.card-label { color: var(--text-3); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 8px; }
.card-big { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 10px 0 6px; }
.card-detail { color: var(--text-2); font-size: 12.5px; line-height: 1.8; }

/* 额度环 */
.quota-card { display: flex; flex-direction: column; }
.quota-ring-wrap { position: relative; width: 120px; height: 120px; margin: 4px auto; }
.quota-ring { transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--surface-2); stroke-width: 10; }
.ring-value { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 314.16; stroke-dashoffset: 314.16; transition: stroke-dashoffset 1s cubic-bezier(.4,0,.2,1), stroke .3s; }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center span:first-child { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.ring-sub { color: var(--text-3); font-size: 11px; }
.quota-unlimited { display: flex; align-items: center; justify-content: center; height: 120px; color: var(--ok); font-weight: 600; font-size: 16px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { border: none; background: transparent; color: var(--text-2); padding: 9px 16px; font-size: 13.5px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* 面板 */
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.table-wrap + .panel-head { margin-top: 24px; }
.panel-head h3, .section-title { font-size: 15px; margin: 0; }
.usage-scope-hint { margin: 3px 0 0; color: var(--text-3); font-size: 12px; }
.usage-toolbar { display: flex; align-items: flex-end; gap: 10px; }
.usage-key-filter-wrap { min-width: 230px; }
.section-title { margin: 24px 0 10px; display: flex; align-items: center; gap: 10px; }
.export-head { align-items: flex-start; gap: 18px; margin-bottom: 14px; }
.export-head p { color: var(--text-3); font-size: 12.5px; margin: 3px 0 0; }
.export-head .btn { flex: 0 0 auto; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { border: none; background: var(--surface); color: var(--text-2); padding: 5px 14px; font-size: 12.5px; cursor: pointer; }
.seg button.active { background: var(--accent); color: #fff; }

/* 表格 */
.table-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 14px; text-align: left; white-space: nowrap; }
th { color: var(--text-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--border); background: var(--surface-2); }
td { border-bottom: 1px solid var(--border); font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
th.num, td.num { text-align: right; }
.empty-row td { text-align: center; color: var(--text-3); padding: 22px; }
.pct-bar { display: inline-block; width: 90px; height: 6px; background: var(--surface-2); border-radius: 3px; vertical-align: middle; margin-right: 6px; }
.pct-fill { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.status-ok { color: var(--ok); }
.status-err { color: var(--danger); }
.token-breakdown {
  border: 0;
  border-bottom: 1px dotted currentColor;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: help;
  font: inherit;
  font-variant-numeric: tabular-nums;
}
.token-breakdown:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.recent-request-cell { width: 220px; min-width: 220px; max-width: 220px; }
.recent-trace-cell { width: 92px; min-width: 92px; max-width: 92px; }
.recent-key-cell { width: 126px; min-width: 126px; max-width: 126px; }
.recent-key-cell code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.share-admin-section { margin-top: 16px; padding: 18px; }
.share-admin-prices { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 14px; }
.share-admin-user-form { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) minmax(150px, .7fr) auto auto; gap: 10px; align-items: end; margin: 14px 0; }
.share-admin-check { display: flex; align-items: center; gap: 7px; min-height: 42px; white-space: nowrap; }
#share-admin-users td small { display: block; margin-top: 4px; color: var(--text-3); }
#share-admin-users td:last-child { white-space: nowrap; }
@media (max-width: 900px) { .share-admin-user-form { grid-template-columns: 1fr; } }

/* ViMoney 流水 */
.billing-panel-head { align-items: flex-end; gap: 16px; }
.billing-toolbar { display: flex; align-items: flex-end; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.billing-toolbar .btn { min-height: 38px; }
.billing-date-toolbar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.billing-date-presets { margin-right: auto; }
.billing-date-field { display: grid; gap: 4px; color: var(--text-3); font-size: 10.5px; }
.billing-date-field input { width: 142px; height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: 12px/1 var(--mono); color-scheme: light dark; }
.billing-date-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.billing-date-separator { align-self: center; margin-top: 15px; color: var(--text-3); font-size: 12px; }
.billing-date-toolbar > .btn { min-height: 34px; }
.billing-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.billing-summary-card { min-width: 0; padding: 13px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.billing-summary-card span { display: block; color: var(--text-3); font-size: 11.5px; }
.billing-summary-card b { display: block; margin-top: 5px; overflow: hidden; color: var(--text); font-size: 18px; text-overflow: ellipsis; white-space: nowrap; font-variant-numeric: tabular-nums; }
.billing-summary-card b.positive { color: var(--ok); }
.billing-summary-card b.negative { color: var(--warn); }
.distributor-banner { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 10px 13px; border: 1px solid rgba(59, 110, 246, .24); border-radius: 11px; background: var(--accent-soft); color: var(--text-2); font-size: 12.5px; }
.distributor-badge { flex: 0 0 auto; border-radius: 999px; padding: 3px 9px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.billing-distribution-section { margin: 16px 0 18px; }
.billing-section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 0 0 8px; }
.billing-section-head h4 { margin: 0; font-size: 14px; }
.billing-section-head p { margin: 2px 0 0; color: var(--text-3); font-size: 11.5px; }
.billing-ledger-head { margin-top: 18px; }
.billing-distribution-table { min-width: 720px; }
.billing-distribution-table td:first-child { width: 220px; max-width: 220px; }
.billing-distribution-table .detail-tooltip-trigger { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.billing-distribution-ratios { display: flex; flex-wrap: wrap; gap: 4px; }
.billing-ledger { padding: 0; overflow: hidden; }
.billing-list { min-height: 160px; }
.billing-load-more { display: flex; margin: 14px auto 0; }
.billing-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 15px 18px; border-bottom: 1px solid var(--border); }
.billing-row:last-child { border-bottom: 0; }
.billing-copy { min-width: 0; flex: 1; }
.billing-remark { color: var(--text); font-size: 13.5px; font-weight: 600; }
.billing-remark.detail-tooltip-trigger { max-width: min(680px, 70vw); overflow: hidden; border-bottom: 1px dotted var(--text-3); text-overflow: ellipsis; white-space: nowrap; }
.billing-time { margin-top: 4px; color: var(--text-3); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.billing-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.billing-tag { border-radius: 999px; padding: 2px 7px; background: var(--surface-2); color: var(--text-2); font-size: 10.5px; }
.billing-tag.commission { background: var(--accent-soft); color: var(--accent); }
.billing-amount { flex: 0 0 auto; color: var(--warn); font-size: 13px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.billing-amount.positive { color: var(--ok); }
.billing-empty { padding: 52px 18px; color: var(--text-3); font-size: 13px; text-align: center; }
.billing-pagination { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 18px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12px; }
.billing-pagination > div { display: flex; gap: 8px; }
.billing-pagination button:disabled { opacity: .45; cursor: not-allowed; }

/* 分销与邀请码 */
.referral-panel-head { align-items: flex-end; gap: 16px; }
.referral-head-actions { display: flex; gap: 8px; }
.referral-permanent { margin-bottom: 12px; padding: 14px 16px; border: 1px solid rgba(59, 110, 246, .28); border-radius: 13px; background: var(--accent-soft); }
.referral-permanent-main { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.referral-permanent-title { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.referral-permanent-link { margin-top: 7px; max-width: 680px; overflow: hidden; color: var(--text); font: 12px/1.5 var(--mono); text-overflow: ellipsis; white-space: nowrap; }
.referral-filters { padding-bottom: 10px; }
.referral-list { display: grid; gap: 12px; }
.referral-card { min-width: 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); padding: 16px 18px; }
.referral-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.referral-card-main { min-width: 0; flex: 1; }
.referral-code-line { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.referral-code { padding: 0; background: transparent; color: var(--text); font-size: 17px; font-weight: 700; letter-spacing: .08em; overflow-wrap: anywhere; }
.referral-chip { border-radius: 999px; padding: 2px 8px; background: var(--surface-2); color: var(--text-2); font-size: 10.5px; }
.referral-chip.primary { background: rgba(16, 185, 129, .12); color: var(--ok); }
.referral-chip.used { background: rgba(245, 158, 11, .14); color: var(--warn); }
.referral-chip.available { background: rgba(16, 185, 129, .12); color: var(--ok); }
.referral-chip.permanent { background: var(--accent); color: #fff; font-weight: 700; }
.referral-chip.source { background: var(--accent-soft); color: var(--accent); }
.referral-code-meta { margin-top: 6px; color: var(--text-3); font-size: 11.5px; }
.referral-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.referral-card-stats { flex: 0 0 auto; display: grid; grid-template-columns: repeat(3, minmax(96px, 1fr)); gap: 8px; }
.referral-card-stat { padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.referral-card-stat span { display: block; color: var(--text-3); font-size: 10.5px; }
.referral-card-stat b { display: block; margin-top: 4px; font-size: 16px; }
.referral-uses { margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--border); }
.referral-uses-title { margin-bottom: 8px; color: var(--text-2); font-size: 12px; font-weight: 600; }
.referral-use-list { display: grid; gap: 7px; }
.referral-use-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.referral-use-user { min-width: 0; font-size: 12.5px; font-weight: 600; overflow-wrap: anywhere; }
.referral-use-time { margin-top: 2px; color: var(--text-3); font-size: 10.5px; }
.referral-use-statuses { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.referral-empty { padding: 20px 12px; border: 1px dashed var(--border); border-radius: 10px; color: var(--text-3); text-align: center; font-size: 12px; }
.detail-tooltip-trigger {
  display: block;
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: help;
  text-align: left;
}
.detail-tooltip-trigger span,
.detail-tooltip-trigger code {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-tooltip-trigger span { margin-bottom: 2px; }
.detail-tooltip-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.token-tooltip {
  position: fixed;
  z-index: 100;
  width: min(280px, calc(100vw - 16px));
  pointer-events: none;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text-2);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .22);
  text-align: left;
  font: 12px/1.65 var(--mono);
}

/* 可用模型卡片 */
.available-model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.model-toolbar-head { align-items: flex-end; gap: 16px; }
.model-toolbar-head p { color: var(--text-3); font-size: 12.5px; margin: 3px 0 0; }
.model-toolbar-actions { display: flex; align-items: flex-end; gap: 10px; }
.filter-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 12px; }
.filter-tabs button {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12.5px;
  cursor: pointer;
}
.filter-tabs button:hover { border-color: var(--accent); color: var(--accent); }
.filter-tabs button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.filter-tabs button span { color: var(--text-3); margin-left: 3px; }
.select-field, .tester-field { display: grid; gap: 5px; color: var(--text-2); font-size: 12px; }
.select-field select,
.tester-field input,
.tester-field textarea,
.tester-request-line input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}
.select-field select { height: 38px; padding: 0 32px 0 10px; }
.select-field select:focus,
.tester-field input:focus,
.tester-field textarea:focus,
.tester-request-line input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.compact-select { min-width: 178px; }
.available-model-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.model-skeleton { display: grid; align-content: start; gap: 13px; min-height: 188px; }
.skeleton-line {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 45%, var(--surface-2) 65%);
  background-size: 240% 100%;
  animation: portal-loading-shimmer 1.5s ease-in-out infinite;
}
.skeleton-title { width: 58%; height: 16px; }
.skeleton-price { width: 76%; height: 25px; margin: 3px 0; }
.skeleton-short { width: 68%; }
.skeleton-chip { width: 38%; height: 22px; margin-top: 5px; }
.model-quick-status { display: flex; flex-wrap: wrap; gap: 5px 12px; margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--border); color: var(--text-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.model-quick-status span { white-space: nowrap; }
.available-model-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.available-model-name {
  min-width: 0;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.available-model-type { flex: 0 0 auto; }
.available-model-price { color: var(--accent); font-weight: 600; margin-top: 9px; }
.available-model-desc {
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.6;
  height: 3.2em;
  margin: 8px 0 10px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.available-model-card .protocol-chip-list { min-width: 0; }

.model-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.stat-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
}
.stat-pill span {
  display: block;
  color: var(--text-3);
  font-size: 11.5px;
  margin-bottom: 4px;
}
.stat-pill b {
  display: block;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 对接信息 */
.connect-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.connect-grid > .card { min-width: 0; align-self: start; }
@media (max-width: 760px) { .connect-grid { grid-template-columns: 1fr; } }
.sdk-download-card { display: grid; gap: 10px; }
.sdk-download-card h3 { margin: 0; font-size: 18px; }
.sdk-download-card > p { margin: 0; color: var(--text-2); font-size: 13px; line-height: 1.7; }
.sdk-download-btn { width: fit-content; text-decoration: none; }
.sdk-direct-upload-note { display: grid; gap: 5px; padding-top: 10px; border-top: 1px solid var(--border); color: var(--text-2); font-size: 12.5px; line-height: 1.6; }
.sdk-direct-upload-note b { color: var(--text); }
.sdk-direct-upload-note code { font-size: 12px; }
.usage-contract { margin-top: 14px; }
.usage-contract h3 { margin: 4px 0 8px; font-size: 17px; }
.usage-contract p, .usage-contract li { color: var(--text-2); font-size: 13px; line-height: 1.7; }
.usage-contract ul { margin: 10px 0 0; padding-left: 20px; }
.usage-contract pre { margin: 12px 0 0; padding: 12px; overflow-x: auto; border-radius: 9px; background: var(--surface-2); font: 12px/1.65 var(--mono); }
.copy-row { display: flex; align-items: center; gap: 8px; margin: 6px 0; }
.copy-row code { font-size: 13px; padding: 6px 10px; flex: 1; overflow-x: auto; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 3px 10px; font-size: 12.5px; font-family: var(--mono); }
.model-chip {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.chip-image { background: rgba(16, 185, 129, .12); color: var(--ok); }
.chip-video { background: rgba(245, 158, 11, .14); color: var(--warn); }
.chip-crowd { background: rgba(6, 182, 212, .14); color: #0891b2; }
.chip-runninghub { background: rgba(236, 72, 153, .13); color: #db2777; }
.chip-embedding { background: rgba(139, 92, 246, .14); color: #8b5cf6; }
.chip-search { background: rgba(14, 165, 233, .14); color: #0ea5e9; }
.chip-protocol { background: var(--surface-2); color: var(--text-2); }
.protocol-chip-list { min-width: 220px; }

.api-key-manager { margin-top: 14px; }
.api-key-manager-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.api-key-manager-head h3 { margin: 0; font-size: 17px; }
.key-count { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.api-key-desc { color: var(--text-2); font-size: 13px; margin: 10px 0 14px; }
.api-key-create-row { display: flex; gap: 10px; }
.api-key-create-row input { min-width: 0; flex: 1; height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font-size: 13px; outline: none; }
.api-key-create-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.api-key-create-row .btn { height: 40px; flex: none; white-space: nowrap; }
.api-key-error { border: 1px solid rgba(239, 68, 68, .3); border-radius: 9px; background: rgba(239, 68, 68, .1); color: var(--danger); font-size: 13px; padding: 9px 12px; margin: 12px 0 0; }
.api-key-created { border: 1px solid rgba(16, 185, 129, .3); border-radius: 10px; background: rgba(16, 185, 129, .1); padding: 12px; margin-top: 12px; }
.api-key-created-title { color: var(--ok); font-size: 13px; font-weight: 600; }
.api-key-created .copy-row { margin-bottom: 0; }
.api-key-created code { background: rgba(0, 0, 0, .16); overflow-wrap: anywhere; white-space: normal; }
.api-key-list { margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.api-key-row {
  display: grid;
  grid-template-columns: minmax(132px, 210px) minmax(0, 1fr) max-content max-content;
  align-items: center;
  gap: 8px 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.api-key-row:last-child { border-bottom: none; }
.api-key-row:hover { background: var(--surface-2); }
.api-key-info { min-width: 0; }
.api-key-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.api-key-prefix { display: inline-block; max-width: 100%; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; color: var(--text-2); }
.api-key-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; color: var(--text-3); font-size: 12px; }
.api-key-meta span { white-space: nowrap; }
.api-key-quota { justify-self: start; width: max-content; max-width: 100%; border-radius: 999px; background: var(--accent-soft); color: var(--accent); padding: 1px 8px; font-size: 11.5px; white-space: nowrap; }
.api-key-actions { display: flex; align-items: center; justify-content: flex-end; gap: 2px; }
.api-key-actions .btn { white-space: nowrap; }
.api-key-revoke { margin-left: 4px; color: var(--danger); white-space: nowrap; }
.api-key-revoke:hover { color: var(--danger); background: rgba(239, 68, 68, .1); }
.api-key-empty { color: var(--text-3); font-size: 13px; text-align: center; padding: 18px 14px; }
@media (max-width: 860px) {
  .api-key-row { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .api-key-actions { justify-content: flex-start; flex-wrap: wrap; }
}
@media (max-width: 620px) {
  .export-head { align-items: stretch; flex-direction: column; }
  .export-head .btn { justify-content: center; }
  .api-key-create-row { flex-direction: column; }
  .api-key-create-row .btn { justify-content: center; }
}

.protocol-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 900px) { .protocol-grid { grid-template-columns: 1fr; } }
.protocol-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  min-width: 0;
}
.protocol-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.protocol-head span { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.protocol-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  margin: 6px 0;
  color: var(--text-2);
  font-size: 12.5px;
}
.protocol-row code { overflow-x: auto; white-space: nowrap; }
.protocol-endpoints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.model-guide, .model-params { display: grid; gap: 12px; }
.model-group, .param-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }
.model-group-head, .param-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.model-group-head span, .param-head span { color: var(--text-3); font-size: 12px; }
.param-table { border-radius: 8px; }
.param-table table { font-size: 12.5px; }
.param-table td { white-space: normal; vertical-align: top; }
.param-table td:first-child, .param-table td:nth-child(2), .param-table td:nth-child(3), .param-table td:nth-child(4) { white-space: nowrap; }

/* 代码片段 */
.snippet { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 14px; overflow: hidden; }
.snippet-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; }
.snippet pre { margin: 0; padding: 14px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; background: none; }

/* API 文档 */
.api-tester { margin-bottom: 18px; }
.api-tester-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.api-tester-head h3 { font-size: 16px; margin: 0; }
.tester-warning { flex: 0 0 auto; border-radius: 999px; background: rgba(245, 158, 11, .14); color: var(--warn); padding: 4px 10px; font-size: 12px; }
.api-tester-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tester-field { margin-top: 10px; }
.tester-field input { height: 40px; padding: 0 11px; font-family: var(--mono); }
.tester-field textarea { min-height: 132px; resize: vertical; padding: 10px 11px; font: 12.5px/1.6 var(--mono); }
.tester-request-line { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px; align-items: center; margin-top: 12px; }
.tester-request-line input { height: 40px; padding: 0 11px; font-family: var(--mono); }
.tester-request-line .method { justify-self: start; }
.tester-request-line .btn { height: 40px; justify-content: center; min-width: 96px; }
.tester-hint { color: var(--text-3); font-size: 12px; margin: 9px 0 0; }
.tester-response { margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.tester-response-head { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); font-family: var(--mono); font-size: 12.5px; }
.tester-response details { border-bottom: 1px solid var(--border); }
.tester-response summary { color: var(--text-2); cursor: pointer; font-size: 12px; padding: 7px 12px; }
.tester-response pre { margin: 0; padding: 12px; max-height: 440px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface); font: 12px/1.6 var(--mono); }
.tester-response details pre { max-height: 180px; background: var(--surface-2); }
.endpoint-test-btn { margin-top: 8px; }
.endpoint { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; overflow: hidden; }
.endpoint-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; cursor: pointer; user-select: none; }
.endpoint-head:hover { background: var(--surface-2); }
.method { font-family: var(--mono); font-size: 11.5px; font-weight: 700; border-radius: 5px; padding: 2px 8px; }
.method-post { background: rgba(16, 185, 129, .12); color: var(--ok); }
.method-get { background: var(--accent-soft); color: var(--accent); }
.endpoint-path { font-family: var(--mono); font-size: 13px; font-weight: 600; }
.endpoint-desc { color: var(--text-3); font-size: 12.5px; margin-left: auto; }
.endpoint-body { display: none; border-top: 1px solid var(--border); padding: 12px 14px; }
.endpoint.open .endpoint-body { display: block; }
.endpoint-body p { margin: 6px 0; color: var(--text-2); font-size: 13px; }
.endpoint-body pre { background: var(--surface-2); border-radius: 8px; padding: 12px; overflow-x: auto; font-family: var(--mono); font-size: 12px; line-height: 1.6; }
.markdown-doc { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 22px 26px; color: var(--text-2); line-height: 1.7; }
.markdown-doc h1, .markdown-doc h2, .markdown-doc h3, .markdown-doc h4 { color: var(--text); line-height: 1.3; margin: 1.15em 0 .55em; }
.markdown-doc h1 { margin-top: 0; font-size: 24px; }
.markdown-doc h2 { padding-top: 12px; border-top: 1px solid var(--border); font-size: 19px; }
.markdown-doc h3 { font-size: 15px; }
.markdown-doc p { margin: .55em 0; }
.markdown-doc ul, .markdown-doc ol { margin: .45em 0 .8em 1.5em; padding: 0; }
.markdown-doc li { margin: .18em 0; }
.markdown-doc code { padding: 2px 5px; border-radius: 4px; background: var(--surface-2); font-family: var(--mono); font-size: .92em; }
.markdown-doc pre { margin: .7em 0 1em; padding: 13px 15px; overflow-x: auto; border-radius: 8px; background: var(--surface-2); color: var(--text); font: 12px/1.6 var(--mono); white-space: pre; }
.markdown-doc pre code { padding: 0; background: transparent; }
.markdown-doc pre .code-key { color: #9cdcfe; }
.markdown-doc pre .code-string { color: #ce9178; }
.markdown-doc pre .code-number, .markdown-doc pre .code-literal { color: #b5cea8; }
.markdown-doc pre .code-punctuation { color: #d4d4d4; }
.markdown-doc pre .code-command { color: #dcdcaa; }
.markdown-doc pre .code-comment { color: #6a9955; }
.markdown-doc a { color: var(--accent); text-decoration: underline; }
.markdown-table-wrap { overflow-x: auto; margin: .8em 0 1em; }
.markdown-doc table { width: 100%; border-collapse: collapse; font-size: 12px; }
.markdown-doc th, .markdown-doc td { padding: 7px 9px; border: 1px solid var(--border); text-align: left; vertical-align: top; }
.markdown-doc th { background: var(--surface-2); color: var(--text); font-weight: 650; }
.ext-link { color: var(--accent); font-weight: 600; text-decoration: none; }
.ext-link:hover { text-decoration: underline; }
#external-docs-card { margin-bottom: 16px; }

/* 图片 / 视频创作工具 */
.tab-tools { color: var(--accent); }
.tool-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border));
  border-radius: 16px;
  background:
    radial-gradient(circle at 88% 15%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 32%),
    linear-gradient(135deg, var(--surface), color-mix(in srgb, var(--accent) 6%, var(--surface)));
}
.tool-eyebrow { color: var(--accent); font: 700 10px/1 var(--mono); letter-spacing: .16em; }
.tool-hero h2 { margin: 7px 0 3px; font-size: 22px; line-height: 1.35; }
.tool-hero p { margin: 0; color: var(--text-2); font-size: 13px; }
.tool-kind-switch {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface-2);
}
.tool-kind-switch button {
  height: 38px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
}
.tool-kind-switch button.active { background: var(--surface); color: var(--accent); box-shadow: 0 2px 8px rgba(0, 0, 0, .08); font-weight: 600; }

/* ChatGPT 风格文本对话 */
.tool-chat-shell {
  position: relative;
  height: 680px;
  min-height: 0;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
}
.chat-sidebar { min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden; border-right: 1px solid var(--border); background: color-mix(in srgb, var(--surface-2) 62%, var(--surface)); }
.chat-sidebar-head { display: flex; gap: 6px; padding: 12px; }
.chat-sidebar-head #chat-new { flex: 1; height: 38px; justify-content: center; }
.chat-sidebar-close { display: none; font-size: 19px; }
.chat-conversations { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.chat-conversation { position: relative; display: flex; align-items: center; gap: 5px; margin: 2px 0; border-radius: 8px; }
.chat-conversation:hover, .chat-conversation.active { background: var(--surface); }
.chat-conversation-main { min-width: 0; flex: 1; border: 0; background: transparent; color: var(--text-2); padding: 9px 8px; text-align: left; cursor: pointer; }
.chat-conversation.active .chat-conversation-main { color: var(--text); }
.chat-conversation-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.chat-conversation-meta { color: var(--text-3); font-size: 10.5px; }
.chat-conversation-delete { flex: 0 0 auto; width: 28px; height: 28px; padding: 0; justify-content: center; opacity: 0; }
.chat-conversation:hover .chat-conversation-delete { opacity: 1; }
.chat-sidebar-empty { padding: 30px 12px; color: var(--text-3); text-align: center; font-size: 12px; }
.chat-sidebar-foot { padding: 10px 12px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 10.5px; text-align: center; }
.chat-main { min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column; overflow: hidden; background: var(--surface); }
.chat-head { height: 60px; flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.chat-sidebar-toggle { display: none; width: 36px; height: 36px; padding: 0; justify-content: center; }
.chat-title-wrap { min-width: 0; flex: 1; }
.chat-title-wrap strong, .chat-title-wrap span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-title-wrap strong { font-size: 14px; }
.chat-title-wrap span { color: var(--text-3); font-size: 10.5px; }
.chat-model-select { display: flex; align-items: center; gap: 7px; color: var(--text-3); font-size: 11px; }
.chat-model-select select { width: min(320px, 30vw); height: 34px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); padding: 0 8px; outline: none; text-overflow: ellipsis; }
.model-picker-info { min-width: 0; margin-top: 8px; padding: 10px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); color: var(--text-2); font-size: 11.5px; line-height: 1.55; overflow-wrap: anywhere; }
.model-picker-info-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.model-picker-info-head strong { min-width: 0; color: var(--text); font-size: 12.5px; }
.model-picker-info-head span { flex: 0 0 auto; color: var(--accent); font-weight: 700; }
.model-picker-info code { display: block; width: fit-content; max-width: 100%; margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-picker-info p { margin: 5px 0 0; }
.model-picker-info small { display: block; margin-top: 4px; color: var(--text-3); }
.model-picker-info.compact { flex: 0 1 260px; margin-top: 0; padding: 6px 8px; }
.model-picker-info.compact .model-picker-info-head { min-width: 0; }
.model-picker-info.compact .model-picker-info-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-picker-info.compact .model-picker-info-head span { min-width: 0; max-width: 56%; flex: 0 1 56%; overflow: hidden; text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.model-picker-info.compact code, .model-picker-info.compact p, .model-picker-info.compact small { display: none; }
.chat-settings { position: relative; flex: 0 0 auto; }
.chat-settings > summary { width: 34px; height: 34px; display: grid; place-items: center; list-style: none; border: 1px solid var(--border); border-radius: 8px; color: var(--text-2); cursor: pointer; user-select: none; }
.chat-settings > summary::-webkit-details-marker { display: none; }
.chat-settings[open] > summary { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.chat-settings-popover { position: absolute; top: 42px; right: 0; z-index: 12; width: min(370px, calc(100vw - 40px)); display: grid; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: 0 18px 54px rgba(0, 0, 0, .2); }
.chat-settings-popover > strong { font-size: 13px; }
.chat-settings-popover label { display: grid; gap: 4px; color: var(--text-2); font-size: 11.5px; }
.chat-settings-popover input, .chat-settings-popover textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); outline: none; padding: 8px 9px; font: 12px/1.5 inherit; resize: vertical; }
.chat-settings-popover input { height: 36px; }
.chat-settings-popover input:focus, .chat-settings-popover textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-settings-popover small { color: var(--text-3); font-size: 10.5px; }
.chat-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.chat-messages { min-height: 0; flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.chat-welcome { min-height: 470px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; text-align: center; }
.chat-welcome-mark { width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 15px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface-2); color: var(--accent); font-size: 24px; }
.chat-welcome h3 { margin: 0; font-size: 21px; }
.chat-welcome p { margin: 6px 0 18px; color: var(--text-3); }
.chat-suggestions { width: min(620px, 100%); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.chat-suggestion { border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--text-2); padding: 10px 12px; cursor: pointer; text-align: left; font-size: 12.5px; }
.chat-suggestion:hover { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.chat-message { padding: 18px 24px; }
.chat-message-inner { width: min(760px, 100%); margin: 0 auto; display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; }
.chat-avatar { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); font-size: 12px; font-weight: 700; }
.chat-message-user .chat-avatar { background: var(--accent); border-color: var(--accent); color: #fff; }
.chat-message-body { min-width: 0; }
.chat-message-role { margin-bottom: 4px; font-size: 12.5px; font-weight: 700; }
.chat-message-time { margin-left: 8px; color: var(--text-3); font-size: 10.5px; font-weight: 400; font-variant-numeric: tabular-nums; }
.chat-message-content { color: var(--text); font-size: 14px; line-height: 1.75; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-message-content code { white-space: pre-wrap; }
.chat-message-reasoning { margin: 8px 0 12px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; color: var(--text-2); background: var(--surface-2); }
.chat-message-reasoning summary { cursor: pointer; font-size: 12px; }
.chat-message-reasoning-content { margin-top: 8px; font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 320px; overflow-y: auto; }
.chat-message-content pre { margin: 10px 0; overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; background: #111318; color: #eef0f4; padding: 12px; white-space: pre; }
.chat-message-content pre code { padding: 0; background: transparent; color: inherit; white-space: pre; font-size: 12.5px; }
.chat-message-attachments { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 9px; }
.chat-message-attachment { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); color: var(--text-2); text-decoration: none; }
.chat-message-attachment img, .chat-message-attachment video { width: 100%; height: 132px; display: block; object-fit: cover; background: #0b0c0f; }
.chat-message-attachment audio { width: 100%; height: 42px; display: block; }
.chat-message-attachment span { display: block; overflow: hidden; padding: 6px 8px; text-overflow: ellipsis; white-space: nowrap; font-size: 10.5px; }
.chat-message.streaming .chat-message-content::after { content: ""; display: inline-block; width: 7px; height: 15px; margin-left: 3px; vertical-align: -2px; border-radius: 1px; background: var(--accent); animation: chat-cursor .8s steps(1) infinite; }
@keyframes chat-cursor { 50% { opacity: 0; } }
.chat-message-actions { min-height: 26px; display: flex; align-items: center; gap: 3px; margin-top: 7px; opacity: 0; transition: opacity .15s; }
.chat-message:hover .chat-message-actions, .chat-message-actions:focus-within { opacity: 1; }
.chat-message-action { border: 0; background: transparent; color: var(--text-3); border-radius: 6px; padding: 3px 7px; cursor: pointer; font-size: 11px; }
.chat-message-action:hover { background: var(--surface-2); color: var(--text); }
.chat-branch-nav { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; color: var(--text-3); font-size: 10.5px; }
.chat-branch-nav button { width: 24px; height: 24px; padding: 0; border: 0; border-radius: 5px; background: transparent; color: inherit; cursor: pointer; }
.chat-branch-nav button:hover { background: var(--surface-2); color: var(--text); }
.chat-composer-wrap { position: sticky; bottom: 0; z-index: 2; padding: 10px max(18px, calc((100% - 780px) / 2)) 12px; background: linear-gradient(transparent, var(--surface) 24%); }
.chat-branch-notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; padding: 7px 10px; border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border)); border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-size: 11.5px; }
.chat-composer { min-height: 54px; padding: 8px; border: 1px solid var(--border); border-radius: 17px; background: var(--surface); box-shadow: 0 8px 28px rgba(0, 0, 0, .09); }
.chat-composer:focus-within { border-color: var(--text-3); box-shadow: 0 8px 30px rgba(0, 0, 0, .12); }
.chat-composer.dragging { border-color: var(--accent); background: var(--accent-soft); }
.chat-composer-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-composer textarea { min-height: 34px; max-height: 190px; flex: 1; resize: none; border: 0; outline: 0; padding: 6px 0; background: transparent; color: var(--text); font: 14px/1.55 inherit; }
.chat-attach { position: relative; flex: 0 0 auto; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 11px; color: var(--text-2); cursor: pointer; font-size: 21px; line-height: 1; }
.chat-attach:hover { background: var(--surface-2); color: var(--text); }
.chat-attach.disabled { opacity: .4; cursor: not-allowed; }
.chat-attach input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.chat-attachments { display: flex; gap: 7px; overflow-x: auto; padding: 0 0 8px; }
.chat-attachment { position: relative; width: 88px; height: 68px; flex: 0 0 88px; overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.chat-attachment img, .chat-attachment video { width: 100%; height: 100%; display: block; object-fit: cover; background: #0b0c0f; }
.chat-attachment-fallback { height: 100%; display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 7px; color: var(--text-2); font-size: 10px; line-height: 1.25; }
.chat-attachment-fallback b, .chat-attachment-fallback span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-attachment-fallback span { color: var(--text-3); }
.chat-attachment-remove { position: absolute; top: 3px; right: 3px; width: 21px; height: 21px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .68); color: #fff; cursor: pointer; font-size: 14px; }
.chat-attachment-status { position: absolute; inset: auto 0 0; padding: 2px 5px; background: rgba(0, 0, 0, .68); color: #fff; font-size: 9.5px; text-align: center; }
.chat-send { flex: 0 0 auto; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 11px; background: var(--text); color: var(--surface); cursor: pointer; font-size: 18px; font-weight: 700; }
.chat-send:disabled { opacity: .35; cursor: not-allowed; }
.chat-composer-hint { margin-top: 6px; color: var(--text-3); font-size: 10.5px; text-align: center; }
.chat-sidebar-backdrop { display: none; }
.tool-layout { display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(360px, .96fr); gap: 14px; align-items: start; }
.tool-compose-card, .tool-result-card { padding: 18px; min-width: 0; }
.tool-result-card { position: sticky; top: 70px; }
.tool-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.tool-section-head h3 { margin: 0; font-size: 17px; }
.tool-price { flex: 0 0 auto; color: var(--accent); border-radius: 999px; padding: 4px 9px; background: var(--accent-soft); font-size: 11.5px; }
.tool-field { display: grid; gap: 6px; margin-top: 12px; color: var(--text-2); font-size: 12.5px; }
.tool-field > span { font-weight: 600; color: var(--text); }
.tool-field > span b { color: var(--danger); }
.tool-field small, .tool-upload-block small { display: block; color: var(--text-3); font-size: 11.5px; font-weight: 400; }
.tool-field select,
.tool-field input,
.tool-field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  font: 13px/1.55 inherit;
  transition: border-color .15s, box-shadow .15s;
}
.tool-field select, .tool-field input { height: 42px; padding: 0 11px; }
.tool-field textarea { padding: 10px 11px; resize: vertical; min-height: 88px; }
.tool-prompt-wrap { position: relative; }
.tool-prompt-wrap textarea { display: block; }
.tool-reference-menu { position: absolute; z-index: 5; left: 8px; right: 8px; bottom: 8px; max-height: 220px; overflow: auto; padding: 4px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); box-shadow: 0 10px 28px rgba(0,0,0,.16); }
.tool-reference-option { width: 100%; display: flex; align-items: center; gap: 9px; padding: 7px 8px; border: 0; border-radius: 7px; background: transparent; color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.tool-reference-option:hover { background: var(--accent-soft); }
.tool-reference-option[aria-selected="true"] { background: var(--accent-soft); }
.tool-reference-option img, .tool-reference-thumb { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 5px; object-fit: cover; background: var(--surface-2); }
.tool-reference-thumb { display: grid; place-items: center; color: var(--text-3); font-size: 16px; }
.tool-prompt-references { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 7px; }
.tool-prompt-reference { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 3px 6px 3px 3px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text); font-size: 11px; }
.tool-prompt-reference img, .tool-prompt-reference .tool-reference-thumb { width: 24px; height: 24px; border-radius: 4px; object-fit: cover; }
.tool-prompt-references button { margin-left: auto; border: 0; background: transparent; color: var(--text-3); cursor: pointer; font: inherit; font-size: 11px; }
.tool-prompt-references button:hover { color: var(--danger); }
.tool-field select:focus, .tool-field input:focus, .tool-field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tool-field textarea + small { text-align: right; }
.tool-parameter-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 10px; }
.tool-parameter-grid .tool-field { min-width: 0; }
.tool-parameter-grid .tool-field-wide { grid-column: 1 / -1; }
.tool-boolean { min-height: 42px; display: flex; align-items: center; gap: 8px; }
.tool-boolean input { width: 17px; height: 17px; accent-color: var(--accent); }
.tool-upload-block { margin-top: 16px; }
.tool-upload-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.tool-upload-head b { display: block; font-size: 12.5px; }
.tool-dropzone {
  min-height: 118px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 1.5px dashed var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text-2);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.tool-dropzone:hover, .tool-dropzone.dragging { border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }
.tool-dropzone.disabled { cursor: not-allowed; opacity: .55; transform: none; }
.tool-dropzone.url-only { cursor: text; }
.tool-dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.tool-upload-icon { display: grid; place-items: center; width: 30px; height: 30px; margin-bottom: 4px; border-radius: 9px; background: var(--surface); color: var(--accent); font-size: 20px; box-shadow: 0 1px 5px rgba(0, 0, 0, .08); }
.tool-dropzone strong { color: var(--text); font-size: 12.5px; }
.tool-dropzone > span:last-child { color: var(--text-3); font-size: 11.5px; }
.tool-reference-url-row { display: grid; grid-template-columns: 108px minmax(0, 1fr) auto; gap: 8px; align-items: stretch; margin-top: 8px; }
.tool-reference-url-row select,
.tool-reference-url-row textarea { min-width: 0; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: 12px/1.45 inherit; outline: none; }
.tool-reference-url-row select { padding: 0 9px; }
.tool-reference-url-row textarea { min-height: 48px; padding: 7px 9px; resize: vertical; }
.tool-reference-url-row select:focus,
.tool-reference-url-row textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tool-reference-url-row button { min-height: 48px; align-self: stretch; }
.tool-file-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.tool-file-item { position: relative; min-width: 0; aspect-ratio: 1 / 1; overflow: hidden; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); }
.tool-file-item[draggable="true"] { cursor: grab; }
.tool-file-item.sorting { opacity: .45; }
.tool-file-item.sort-target { outline: 2px solid var(--accent); outline-offset: -2px; }
.tool-file-label { position: absolute; top: 4px; left: 4px; padding: 2px 5px; border-radius: 4px; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; pointer-events: none; }
.tool-file-order { position: absolute; right: 4px; bottom: 4px; display: flex; gap: 4px; }
.tool-file-order button { width: 26px; height: 24px; border: 0; border-radius: 5px; background: rgba(0,0,0,.65); color: #fff; cursor: pointer; }
.tool-file-order button:disabled { opacity: .4; cursor: default; }
.tool-sort-hint { display: block; margin-top: 6px; color: var(--text-3); font-size: 11px; }
.tool-file-list:empty + .tool-sort-hint { display: none; }
.tool-tail-actions, .tool-tail-frame { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 8px; padding: 12px; width: 100%; background: var(--surface); }
.tool-tail-frame img { width: 120px; height: 90px; object-fit: contain; border-radius: 6px; }
.tool-file-item img, .tool-file-item video { width: 100%; height: 100%; display: block; object-fit: cover; }
.tool-media-frame audio { width: min(100%, 520px); min-height: 42px; }
.tool-file-fallback { height: 100%; display: grid; place-items: center; padding: 8px; color: var(--text-2); font-size: 11px; text-align: center; overflow-wrap: anywhere; }
.tool-file-remove { position: absolute; top: 4px; right: 4px; width: 23px; height: 23px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 999px; background: rgba(0, 0, 0, .62); color: #fff; cursor: pointer; }
.tool-advanced { margin-top: 14px; border: 1px solid var(--border); border-radius: 10px; background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.tool-advanced summary { padding: 10px 12px; cursor: pointer; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.tool-advanced summary span { color: var(--text-3); font-weight: 400; }
.tool-advanced[open] { padding: 0 12px 12px; }
.tool-advanced[open] summary { margin: 0 -12px; }
.tool-advanced > p { margin: 0 0 3px; color: var(--text-3); font-size: 11.5px; }
.tool-extra-json textarea, .tool-json-param textarea { font-family: var(--mono); font-size: 12px; }
.tool-generate { width: 100%; height: 46px; justify-content: center; margin-top: 16px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.tool-generate.loading #tool-generate-icon { animation: tool-spin .8s linear infinite; }
@keyframes tool-spin { to { transform: rotate(360deg); } }
.tool-charge-note { margin: 7px 0 0; color: var(--text-3); font-size: 11.5px; text-align: center; }
.tool-result-stage {
  min-height: 440px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 13px;
  background:
    linear-gradient(45deg, color-mix(in srgb, var(--surface-2) 70%, transparent) 25%, transparent 25%) 0 0 / 18px 18px,
    linear-gradient(-45deg, color-mix(in srgb, var(--surface-2) 70%, transparent) 25%, transparent 25%) 0 9px / 18px 18px,
    var(--surface);
}
.tool-result-empty { display: flex; flex-direction: column; justify-content: center; gap: 4px; color: var(--text-3); }
.tool-result-empty strong { color: var(--text-2); font-size: 14px; }
.tool-empty-visual { display: grid; place-items: center; width: 62px; height: 62px; margin-bottom: 8px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); font-size: 26px; }
.tool-result-stage img, .tool-result-stage video { width: 100%; max-height: 620px; display: block; object-fit: contain; background: #050505; }
.tool-transcription-result { width: 100%; align-self: stretch; padding: 16px; overflow: auto; }
.tool-transcription-text { white-space: pre-wrap; line-height: 1.7; font-size: 15px; color: var(--text-1); }
.tool-transcription-result dl { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 16px 0 0; color: var(--text-3); font-size: 12px; }
.tool-transcription-result dl div { display: flex; gap: 5px; }
.tool-transcription-result dt { font-weight: 600; }
.tool-transcription-result dd { margin: 0; color: var(--text-2); }
.tool-transcription-result details { margin-top: 14px; }
.tool-transcription-result pre { max-height: 260px; overflow: auto; white-space: pre-wrap; font-size: 11px; }
.tool-history-transcription { width: 100%; padding: 12px; white-space: pre-wrap; overflow: hidden; max-height: 130px; line-height: 1.5; text-align: left; font-size: 12px; }
.tool-media-frame { position: relative; width: 100%; min-width: 0; overflow: hidden; display: grid; place-items: center; }
.tool-media-actions { position: absolute; right: 10px; bottom: 10px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
.tool-media-actions .tool-media-download, .tool-media-actions .tool-media-view {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 9px;
  padding: 7px 11px;
  background: rgba(0, 0, 0, .68);
  color: #fff;
  backdrop-filter: blur(8px);
  text-decoration: none;
  font: inherit;
  font-size: 11.5px;
  cursor: pointer;
  opacity: .9;
  transition: opacity .15s, transform .15s;
}
.tool-media-actions .tool-media-download:hover, .tool-media-actions .tool-media-view:hover,
.tool-media-actions .tool-media-download:focus-visible, .tool-media-actions .tool-media-view:focus-visible { opacity: 1; transform: translateY(-1px); }
.tool-image-viewer {
  width: min(96vw, 1600px);
  max-width: none;
  max-height: 96vh;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 14px;
  padding: 12px;
  background: #101216;
  color: #fff;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .48);
}
.tool-image-viewer::backdrop { background: rgba(5, 7, 11, .86); backdrop-filter: blur(5px); }
.tool-image-viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.tool-image-viewer-head strong { font-size: 13px; }
.tool-image-viewer > img { display: block; max-width: 100%; max-height: calc(96vh - 82px); margin: 0 auto; object-fit: contain; }
.tool-result-stage.tool-result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: center; gap: 4px; padding: 4px; }
.tool-result-stage.tool-result-grid img { height: 100%; min-height: 180px; object-fit: contain; }
.tool-progress { width: min(280px, calc(100% - 40px)); text-align: center; }
.tool-progress-orbit { position: relative; width: 66px; height: 66px; margin: 0 auto 16px; border: 3px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: tool-spin .9s linear infinite; }
.tool-progress b { display: block; margin-bottom: 4px; font-size: 14px; }
.tool-progress span { color: var(--text-3); font-size: 12px; }
.tool-progress .tool-live-elapsed { display: block; margin-top: 8px; color: var(--accent); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.tool-progress-track { height: 5px; overflow: hidden; margin-top: 14px; border-radius: 999px; background: var(--surface-2); }
.tool-progress-track i { display: block; height: 100%; width: 35%; border-radius: inherit; background: var(--accent); animation: tool-progress 2s ease-in-out infinite; }
@keyframes tool-progress { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.tool-status { border-radius: 999px; padding: 3px 9px; font-size: 11.5px; background: var(--accent-soft); color: var(--accent); }
.tool-status.success { color: var(--ok); background: rgba(16, 185, 129, .12); }
.tool-status.failed { color: var(--danger); background: rgba(239, 68, 68, .1); }
.tool-result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tool-result-actions .btn { justify-content: center; }
.tool-error { margin: 10px 0 0; padding: 10px 12px; border: 1px solid rgba(239, 68, 68, .25); border-radius: 9px; background: rgba(239, 68, 68, .08); color: var(--danger); font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.tool-history-section { margin-top: 22px; }
.tool-history-section .panel-head { align-items: flex-end; }
.tool-history-section .panel-head p { margin: 2px 0 0; color: var(--text-3); font-size: 12px; }
.tool-history-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tool-history-card { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); cursor: pointer; transition: border-color .15s, transform .15s; }
.tool-history-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-history-preview { position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden; background: var(--surface-2); color: var(--text-3); }
.tool-history-preview img, .tool-history-preview video { width: 100%; height: 100%; object-fit: cover; }
.tool-history-preview .tool-progress-orbit { width: 34px; height: 34px; margin: 0; border-width: 2px; }
.tool-history-kind { position: absolute; top: 7px; left: 7px; border-radius: 999px; padding: 2px 7px; background: rgba(0, 0, 0, .62); color: #fff; font-size: 10px; }
.tool-history-download { position: absolute; right: 7px; bottom: 7px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: rgba(0, 0, 0, .68); color: #fff; text-decoration: none; opacity: .82; }
.tool-history-download:hover { opacity: 1; }
.tool-history-info { padding: 9px 10px; }
.tool-history-prompt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 600; }
.tool-history-references { display: flex; align-items: center; gap: 4px; margin-top: 7px; min-height: 24px; }
.tool-history-references img, .tool-history-references span, .tool-history-references b { width: 24px; height: 24px; flex: 0 0 auto; border: 1px solid var(--border); border-radius: 6px; background: var(--surface-2); color: var(--text-2); object-fit: cover; display: grid; place-items: center; font-size: 10px; font-weight: 600; }
.tool-history-meta { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3); font-size: 10.5px; }
.tool-history-empty { grid-column: 1 / -1; padding: 26px; border: 1px dashed var(--border); border-radius: 12px; color: var(--text-3); text-align: center; }

@media (max-width: 900px) {
  .tool-layout { grid-template-columns: 1fr; }
  .tool-result-card { position: static; }
  .tool-result-stage { min-height: 360px; }
  .tool-history-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .tool-hero { align-items: stretch; flex-direction: column; padding: 15px; }
  .tool-kind-switch { width: 100%; }
  .tool-kind-switch button { font-size: 11.5px; }
  .tool-parameter-grid { grid-template-columns: 1fr; }
  .tool-parameter-grid .tool-field-wide { grid-column: auto; }
  .tool-file-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tool-reference-url-row { grid-template-columns: 96px minmax(0, 1fr); }
  .tool-reference-url-row button { grid-column: 1 / -1; min-height: 40px; }
  .tool-history-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-result-stage { min-height: 300px; }
  .tool-result-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-result-actions .btn:last-child { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .tool-chat-shell { grid-template-columns: 1fr; height: 640px; min-height: 0; }
  .chat-main { min-height: 0; }
  .chat-sidebar { position: absolute; inset: 0 auto 0 0; z-index: 8; width: min(290px, 86vw); transform: translateX(-102%); box-shadow: 16px 0 44px rgba(0, 0, 0, .24); transition: transform .2s ease; }
  .tool-chat-shell.sidebar-open .chat-sidebar { transform: translateX(0); }
  .chat-sidebar-close, .chat-sidebar-toggle { display: inline-flex; }
  .chat-sidebar-backdrop { position: absolute; inset: 0; z-index: 7; display: block; background: rgba(0, 0, 0, .4); }
  .chat-model-select span { display: none; }
  .chat-model-select select { width: min(180px, 38vw); }
  .model-picker-info.compact { display: none; }
  .chat-message { padding: 16px 14px; }
  .chat-message-inner { grid-template-columns: 28px minmax(0, 1fr); gap: 9px; }
  .chat-avatar { width: 28px; height: 28px; }
  .chat-message-actions { opacity: 1; }
  .chat-composer-wrap { padding-inline: 10px; }
  .chat-message-attachments { grid-template-columns: minmax(0, 1fr); }
  .chat-suggestions { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .model-toolbar-head, .api-tester-head { align-items: stretch; flex-direction: column; }
  .panel-head.billing-panel-head, .panel-head.referral-panel-head { align-items: stretch; flex-direction: column; }
  .billing-toolbar { align-items: stretch; flex-direction: column; width: 100%; }
  .billing-toolbar .btn { justify-content: center; }
  .billing-date-toolbar { align-items: stretch; }
  .billing-date-presets { width: 100%; margin-right: 0; }
  .billing-date-presets button { flex: 1; padding-inline: 7px; }
  .billing-date-field { flex: 1; min-width: 130px; }
  .billing-date-field input { width: 100%; }
  .billing-date-separator { display: none; }
  .billing-date-toolbar > .btn { width: 100%; justify-content: center; }
  .billing-remark.detail-tooltip-trigger { max-width: calc(100vw - 130px); }
  .referral-head-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .referral-head-actions .btn { justify-content: center; }
  .referral-permanent-main { align-items: stretch; flex-direction: column; }
  .referral-card-head { flex-direction: column; }
  .referral-card-stats { width: 100%; }
  .referral-use-row { align-items: flex-start; flex-direction: column; }
  .referral-use-statuses { justify-content: flex-start; }
  .usage-toolbar { width: 100%; align-items: stretch; flex-direction: column; }
  #tab-daily .panel-head, #tab-recent .panel-head { align-items: stretch; flex-direction: column; gap: 10px; }
  .model-toolbar-actions { align-items: stretch; flex-direction: column-reverse; }
  .model-toolbar-actions .btn { justify-content: center; }
  .compact-select { width: 100%; }
  .api-tester-grid { grid-template-columns: 1fr; }
  .tester-request-line { grid-template-columns: auto minmax(0, 1fr); }
  .tester-request-line .btn { grid-column: 1 / -1; }
  .tester-warning { align-self: flex-start; }
  .endpoint-head { flex-wrap: wrap; }
  .endpoint-desc { width: 100%; margin-left: 0; }
}

@media (max-width: 520px) {
  .billing-pagination { align-items: stretch; flex-direction: column; }
  .billing-pagination > div { display: grid; grid-template-columns: 1fr 1fr; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 50;
  background: var(--text);
  color: var(--surface);
  border-radius: 999px;
  padding: 9px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  font-size: 13px;
}
.toast-error { background: var(--danger); color: #fff; }

/* 个人中心：右侧抽屉与可返回的子面板。 */
.account-trigger { display: inline-flex; align-items: center; gap: 9px; min-height: 38px; max-width: 230px; padding: 4px 10px 4px 5px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; }
.account-trigger:hover { border-color: var(--accent); }
#account-trigger-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; font-size: 12px; }
.account-avatar { position: relative; display: inline-grid; place-items: center; width: 30px; height: 30px; flex: none; overflow: hidden; border-radius: 50%; background: var(--accent-soft); color: var(--accent); border: 1px solid var(--border); font-weight: 700; }
.account-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.account-avatar-large { width: 60px; height: 60px; font-size: 24px; border-radius: 19px; }
body.account-panel-open { overflow: hidden; }
.account-layer { position: fixed; inset: 0; z-index: 55; }
.account-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .46); backdrop-filter: blur(4px); }
.account-panel { position: absolute; inset: 0 0 0 auto; width: min(500px, 100%); display: flex; flex-direction: column; background: var(--surface); border-left: 1px solid var(--border); box-shadow: -24px 0 80px rgba(0, 0, 0, .2); animation: account-slide-in .2s ease-out; }
.account-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 24px; border-bottom: 1px solid var(--border); }
.account-panel-heading { display: flex; align-items: center; gap: 10px; }
.account-panel h2 { font-size: 20px; margin: 4px 0 0; letter-spacing: -.025em; }
.account-panel-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 24px; }
.account-identity { display: flex; align-items: center; gap: 15px; margin-bottom: 24px; min-width: 0; }
.account-identity > div { min-width: 0; }
.account-identity h3 { margin: 0; font-size: 20px; overflow-wrap: anywhere; }
.account-identity p { margin: 4px 0 8px; color: var(--text-3); font-size: 12px; overflow-wrap: anywhere; }
.account-wallet-card { display: grid; gap: 7px; margin-bottom: 24px; padding: 20px; border: 1px solid var(--border); border-radius: 15px; background: radial-gradient(ellipse at top right, var(--accent-soft), transparent 75%), var(--bg); }
.account-wallet-card > span { color: var(--text-2); font-size: 12px; }
.account-wallet-card > strong { font: 600 32px/1.4 var(--mono); color: var(--accent); overflow-wrap: anywhere; }
.account-wallet-card > small { color: var(--text-3); }
.account-wallet-card > button { justify-self: start; margin-top: 10px; }
.account-menu { display: grid; gap: 4px; }
.account-menu > button { display: flex; justify-content: space-between; align-items: center; gap: 20px; width: 100%; padding: 15px 12px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.account-menu > button:hover { background: var(--surface-2); border-color: var(--border); }
.account-menu b { font-size: 14px; font-weight: 500; }
.account-menu small { display: block; color: var(--text-3); font-size: 12px; margin-top: 4px; }
.account-menu > button > span:last-child { color: var(--text-3); font-size: 20px; }
.account-note { color: var(--text-3); font-size: 12px; line-height: 1.9; overflow-wrap: anywhere; }
.account-logout { width: 100%; margin-top: 15px; color: var(--danger); border-color: var(--border); }
.account-panel-footer { padding: 15px 24px max(15px, env(safe-area-inset-bottom)); text-align: center; font-size: 11px; color: var(--text-3); border-top: 1px solid var(--border); }
.account-section { margin-top: 24px; }
.account-section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 15px; }
.account-details { margin: 24px 0; }
.account-details > div { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 15px; padding: 13px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.account-details dt { color: var(--text-3); }
.account-details dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.account-wallet-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.account-wallet-summary > div { display: grid; gap: 8px; padding: 12px 10px; border: 1px solid var(--border); background: var(--bg); border-radius: 10px; }
.account-wallet-summary span { color: var(--text-3); font-size: 11px; }
.account-wallet-summary b { font-size: 13px; overflow-wrap: anywhere; }
.account-transaction { display: flex; justify-content: space-between; align-items: center; gap: 18px; width: 100%; padding: 16px 0; border: 0; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.account-transaction > span { min-width: 0; overflow-wrap: anywhere; }
.account-transaction > span:last-child { text-align: right; flex-shrink: 0; max-width: 46%; }
.account-transaction b { font-size: 13px; font-weight: 500; }
.account-transaction small { display: block; color: var(--text-3); font-size: 11px; margin-top: 5px; }
.account-transaction:hover b { color: var(--accent); }
.account-wallet-pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 20px; font-size: 12px; color: var(--text-3); }
.account-theme-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.account-theme-option { display: grid; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); color: var(--text); text-align: left; cursor: pointer; }
.account-theme-option[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.account-theme-preview { display: grid; place-items: center; min-height: 100px; border-radius: 8px; font-size: 32px; }
.account-theme-preview.dark { background: #171914; color: #d5b578; }
.account-theme-preview.light { background: #faf9f6; color: #916b2d; }
.account-theme-option small { color: var(--text-3); font-size: 11px; line-height: 1.7; }
.account-panel button:disabled { opacity: .5; cursor: not-allowed; }
@keyframes account-slide-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
@media (max-width: 600px) {
  .account-trigger { max-width: 120px; padding-right: 5px; }
  #account-trigger-name { max-width: 58px; }
  .account-trigger > span:last-child { display: none; }
  .account-panel-head, .account-panel-body { padding: 20px; }
  .topbar-inner { gap: 8px; padding-inline: 12px; }
  .topbar-actions { gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
  .brand { gap: 6px; font-size: 12px; }
  .brand-sub { margin-left: 5px; padding-left: 6px; font-size: 11px; white-space: nowrap; }
}
@media (prefers-reduced-motion: reduce) { .account-panel { animation: none; } }

/* 充值弹窗 */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .48); backdrop-filter: blur(4px); }
.modal-panel { position: relative; width: min(720px, 100%); max-height: min(760px, calc(100vh - 40px)); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: 0 24px 80px rgba(0, 0, 0, .28); padding: 18px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.modal-head h2 { margin: 2px 0 0; font-size: 18px; }
.modal.account-recharge-drawer { padding: 0; justify-items: end; }
.account-recharge-drawer .modal-panel { width: min(500px, 100%); height: 100dvh; max-height: 100dvh; border-radius: 0; border-width: 0 0 0 1px; padding: 24px; animation: account-slide-in .2s ease-out; }
@media (prefers-reduced-motion: reduce) { .account-recharge-drawer .modal-panel { animation: none; } }
.recharge-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.recharge-package { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 12px; padding: 14px; cursor: pointer; text-align: left; transition: border-color .15s, background .15s; }
.recharge-package:hover, .recharge-package.active { border-color: var(--accent); background: var(--accent-soft); }
.recharge-package-title { color: var(--text-3); font-size: 12px; }
.recharge-package-price { margin-top: 8px; font-size: 20px; font-weight: 700; }
.recharge-package-vimoney { margin-top: 10px; color: var(--accent); font-size: 24px; font-weight: 700; }
.recharge-summary { margin-top: 14px; border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: var(--surface-2); }
.recharge-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.payment-methods { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.payment-methods button.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.qr-box { margin: 14px auto 0; width: min(280px, 100%); border: 1px solid var(--border); border-radius: 12px; padding: 12px; background: #fff; }
.qr-box img { width: 100%; aspect-ratio: 1 / 1; object-fit: contain; display: block; }
.qr-box canvas { width: 100%; height: auto; aspect-ratio: 1 / 1; display: block; }
.qr-status { margin-top: 10px; text-align: center; color: var(--text-2); }
#result-view.portal-guest > .status-bar,
#result-view.portal-guest > .cards,
#result-view.portal-guest > #quota-alert { display: none; }
.tabs a.tab { text-decoration: none; }

/* 用户工作台：与 Vimox Pix 一致的暖白、古铜金与细网格。 */
a { color: var(--accent); }
:where(a, button, input, select, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.brand { gap: 12px; letter-spacing: -.02em; }
.brand-dot { width: 28px; height: 28px; border-radius: 9px; background: var(--accent); position: relative; flex: none; }
.brand-dot::after { content: ""; position: absolute; inset: 7px; border: 1.5px solid var(--surface); border-radius: 50%; }
.brand-sub { margin-left: 9px; padding-left: 12px; border-left: 1px solid var(--border); }
.btn { min-height: 36px; border-radius: 9px; font-weight: 500; }
.btn-sm { min-height: 30px; }
.btn-primary { color: #fffdf7; }
[data-theme="dark"] .btn-primary, [data-theme="dark"] .seg button.active { color: #24271f; }
.btn-primary:hover { filter: brightness(.94); }
.footer { background: var(--surface); letter-spacing: .05em; }

/* 登录保留完整认证表单，桌面双栏，窄屏纵向排列。 */
.container:has(> #login-view:not(.hidden)) { padding: 0; display: flex; }
#login-view { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: calc(100dvh - 126px); }
#login-view .hero { position: relative; isolation: isolate; display: flex; flex-direction: column; justify-content: space-between; gap: 44px; margin: 0; padding: clamp(36px, 4.5vw, 84px); background: var(--hero-bg); text-align: left; }
#login-view .hero::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: 56px 56px; }
.login-eyebrow { display: inline-flex; align-items: center; gap: 10px; color: var(--accent); font-size: 11px; letter-spacing: .12em; }
.hero > .login-eyebrow::before { content: ""; width: 24px; height: 1px; background: var(--accent); }
.login-hero-content { max-width: 660px; padding: 8px 0; }
#login-view .hero h1 { margin: 0 0 24px; font-family: "Songti SC", "STSong", SimSun, Georgia, serif; font-size: clamp(38px, 4vw, 72px); font-weight: 500; line-height: 1.35; letter-spacing: -.045em; }
#login-view .hero h1 span { color: var(--accent); }
#login-view .login-description { font-size: 14px; line-height: 2; }
.login-features { display: grid; gap: 22px; margin-top: 40px; }
.login-feature { display: flex; gap: 15px; align-items: flex-start; }
.login-feature-mark { display: grid; place-items: center; width: 38px; height: 38px; flex: none; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--accent); font: 12px/1 var(--mono); }
.login-feature h3 { margin: 0 0 4px; font-size: 13px; font-weight: 600; }
#login-view .login-feature p { font-size: 12px; line-height: 1.8; }
.login-public-links { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.login-public-links a { font-size: 12px; text-decoration: none; text-underline-offset: 5px; }
.login-public-links a:hover { text-decoration: underline; }
.login-section { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 48px clamp(24px, 4vw, 72px); min-width: 0; }
.login-card { width: 100%; max-width: 480px; padding: 36px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); margin: 0; }
.login-card-heading { margin-bottom: 28px; }
.login-card-heading h2 { margin: 12px 0 8px; font-size: clamp(21px, 2vw, 27px); font-weight: 600; letter-spacing: -.035em; line-height: 1.5; }
.login-card-heading p { color: var(--text-2); font-size: 13px; margin: 0; }
.login-card .auth-tabs { border-color: transparent; margin-bottom: 24px; }
.login-card .form-field { gap: 7px; }
.login-card .form-field input { height: 46px; background: var(--bg); }
.login-card .account-form { gap: 17px; margin-bottom: 20px; }
.login-card .account-submit { height: 46px; margin-top: 5px; }
.login-card .oauth-row { margin: 22px 0 0; }
.login-card .oauth-login-btn { border-color: var(--border); }
.login-card .privacy-note { border-top: 1px solid var(--border); padding-top: 20px; margin: 24px 0 0; line-height: 1.9; font-size: 11px; }
.login-error:not(.hidden) { background: rgba(239, 68, 68, .07); border: 1px solid rgba(239, 68, 68, .2); padding: 10px 12px; border-radius: 8px; overflow-wrap: anywhere; }
.login-footer { margin: 0; color: var(--text-3); text-align: center; font-size: 11px; letter-spacing: .03em; }

/* 全宽内容、统一导航与阅读层次。 */
#result-view, .tab-panel { min-width: 0; }
.status-bar { margin-bottom: 22px; padding: 0 2px; }
.cards { gap: 18px; margin-bottom: 28px; }
.card, .available-model-card, .stat-pill, .endpoint, .table-wrap { box-shadow: var(--shadow); border-radius: 14px; }
.card { padding: 22px; }
.card-label { color: var(--text-2); letter-spacing: .08em; }
.card-big { font-size: 32px; font-weight: 600; letter-spacing: -.04em; }
.tabs { gap: 5px; padding: 7px; margin-bottom: 30px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); scrollbar-width: thin; }
.tab { border: 0; border-radius: 7px; padding: 10px 17px; font-size: 13px; }
.tab:hover { background: var(--surface-2); }
.tab.active { border: 0; color: var(--accent); background: var(--accent-soft); }
.panel-head { margin-bottom: 20px; gap: 16px; }
.panel-head h3, .section-title { font-size: 18px; letter-spacing: -.025em; }
th, td { padding: 13px 18px; }
th { font-size: 11px; color: var(--text-2); background: var(--surface-2); }
tbody tr:hover { background: var(--accent-soft); }
.available-model-grid { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 18px; }
.available-model-card { padding: 22px; transition: border-color .15s, box-shadow .15s; }
.available-model-card:hover { border-color: var(--accent); box-shadow: 0 6px 22px var(--accent-soft); }
.available-model-price { margin-top: 18px; font-size: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.model-price-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; color: var(--text-2); font-size: 11px; font-weight: 400; margin-bottom: 8px; }
.model-price-rates { margin: 0; }
.model-price-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); align-items: start; gap: 12px; padding: 8px 0; }
.model-price-row + .model-price-row { border-top: 1px solid var(--border); }
.model-price-row dt { color: var(--text); font-size: 13px; font-weight: 500; padding-top: 2px; overflow-wrap: anywhere; }
.model-price-row dd { margin: 0; min-width: 0; text-align: right; overflow-wrap: anywhere; }
.model-price-row strong { display: block; font-size: 16px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.5; }
.model-price-row small { display: block; color: var(--text-2); font-size: 11px; font-weight: 400; line-height: 1.6; margin-top: 2px; }
.model-price-note, .model-price-unavailable { margin: 8px 0; font-size: 12px; font-weight: 400; color: var(--text-2); }
.model-view-tabs { display: inline-flex; gap: 3px; padding: 3px; margin: 0 0 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.model-view-tabs button { min-width: 72px; min-height: 34px; padding: 6px 14px; border: 0; border-radius: 5px; background: transparent; color: var(--text-2); font: inherit; cursor: pointer; }
.model-view-tabs button:hover { background: var(--surface-2); color: var(--text); }
.model-view-tabs button.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.model-status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); gap: 14px; }
.model-status-card { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.model-status-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.model-status-name { min-width: 0; color: var(--text); font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.model-status-summary { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-top: 13px; color: var(--text-2); font-size: 12px; }
.model-status-summary strong { color: var(--text); font-size: 18px; font-variant-numeric: tabular-nums; }
.model-status-metrics { display: flex; flex-wrap: wrap; gap: 5px 14px; margin-top: 8px; color: var(--text-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.model-status-hours { display: grid; grid-template-columns: repeat(24, minmax(0, 1fr)); gap: 3px; margin-top: 14px; }
.model-status-hour { display: block; height: 18px; min-width: 0; border: 1px solid transparent; border-radius: 3px; cursor: help; }
.model-status-hour:hover { outline: 2px solid var(--text); outline-offset: 1px; }
.model-status-hour.excellent { background: #16824b; }
.model-status-hour.good { background: #72a94f; }
.model-status-hour.warning { background: #e2a735; }
.model-status-hour.poor { background: #c84f45; }
.model-status-hour.empty { border-color: var(--border); background: var(--surface-2); }
.model-status-axis { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; color: var(--text-3); font-size: 10px; font-variant-numeric: tabular-nums; }
.model-status-empty { grid-column: 1 / -1; padding: 30px 12px; color: var(--text-3); text-align: center; }
[data-theme="dark"] .model-status-hour.excellent { background: #2d9b62; }
[data-theme="dark"] .model-status-hour.good { background: #86ad53; }
[data-theme="dark"] .model-status-hour.warning { background: #d89a33; }
[data-theme="dark"] .model-status-hour.poor { background: #d55b50; }
.filter-tabs { padding-bottom: 20px; }
.connect-grid { gap: 18px; align-items: stretch; }
.connect-grid > .card { display: flex; flex-direction: column; min-width: 0; align-self: stretch; }
.connect-grid .card-label { margin-bottom: 12px; }
.connect-grid .card-detail { line-height: 1.8; }
.connect-grid .sdk-download-card h3 { font-size: 20px; margin: 0 0 10px; }
.connect-grid .sdk-download-card { gap: 0; }
.connect-grid .sdk-download-card p { margin: 0 0 16px; font-size: 13px; line-height: 1.8; }
.connect-grid .sdk-download-btn { align-self: flex-start; }
.connect-grid .sdk-direct-upload-note { font-size: 12px; line-height: 1.8; margin-top: 16px; }
.connect-grid .sdk-direct-upload-note summary { cursor: pointer; color: var(--text-2); }
.connect-grid .sdk-direct-upload-note[open] summary { margin-bottom: 10px; }
.connect-grid .copy-row { margin: 0 0 16px; }
.connect-grid .copy-row code { padding: 14px; font-size: 14px; }
.api-key-list-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.api-key-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); padding: 18px; gap: 12px 20px; }
.api-key-actions { flex-wrap: wrap; }
.api-key-quota { width: auto; white-space: normal; border-radius: 8px; line-height: 1.8; overflow-wrap: anywhere; }
#vimoney-balance { font-size: clamp(22px, 2.2vw, 32px); overflow-wrap: anywhere; }
#vimoney-cny { font-size: 15px; color: var(--accent); margin-top: 8px; }
#tab-daily .cards { margin-bottom: 28px; }
#tab-daily .card-big { font-size: clamp(24px, 2.4vw, 34px); }
@media (max-width: 860px) { .api-key-row { grid-template-columns: minmax(0, 1fr); } }
.model-guide, .model-params { grid-template-columns: minmax(0, 1fr); }
.model-group, .param-card { min-width: 0; }
.model-group-head, .param-head { flex-wrap: wrap; overflow-wrap: anywhere; }
.copy-row code, .key-input-wrap { min-width: 0; }
.protocol-endpoints code { overflow-wrap: anywhere; }
.markdown-doc { overflow-wrap: anywhere; }
.markdown-doc pre { background: #242820; color: #eeeee5; }
.markdown-doc { padding: clamp(18px, 2.2vw, 36px); }
.markdown-doc p, .markdown-doc li { line-height: 1.9; }
.endpoint-head { padding: 16px 20px; }
.endpoint-body { padding: 18px 20px; }

@media (min-width: 1600px) {
  .cards { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
}
@media (max-width: 1000px) {
  #login-view { grid-template-columns: minmax(0, 1fr); }
  #login-view .hero { padding: 36px 24px 28px; gap: 24px; align-items: center; text-align: center; }
  #login-view .hero h1 { font-size: 38px; margin-bottom: 16px; }
  #login-view .hero h1 span { display: inline-block; }
  .login-features { display: none; }
  .login-public-links { justify-content: center; }
  .login-section { justify-content: flex-start; padding: 32px 24px 40px; }
}
@media (max-width: 760px) {
  .topbar-inner { padding: 12px 16px; flex-wrap: wrap; gap: 10px; }
  .topbar-actions { gap: 3px; flex-wrap: wrap; }
  .topbar-actions .btn { padding-inline: 9px; }
  .brand { font-size: 14px; }
  .brand-sub { font-size: 11px; margin-left: 5px; padding-left: 8px; }
  .container { padding: 22px 16px 36px; }
  .cards { gap: 12px; }
  .card { padding: 18px; }
  .tabs { margin-bottom: 24px; }
  .tab { padding: 10px 13px; }
  .available-model-grid { gap: 12px; }
  .available-model-card { padding: 18px; }
  .connect-grid { gap: 14px; }
  .status-bar { overflow-wrap: anywhere; }
  .key-meta { overflow-wrap: anywhere; min-width: 0; }
}
@media (max-width: 420px) {
  #login-view .hero { padding: 32px 20px 24px; }
  #login-view .hero h1 { font-size: clamp(26px, 7.8vw, 31px); }
  #login-view .login-description { font-size: 12px; }
  .login-section { padding: 24px 16px 32px; }
  .login-card { padding: 28px 22px; }
  .login-public-links { gap: 12px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
