/* Shared stylesheet of the user portal (/user), the admin console (/admin) and the CLI login page. */
:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --hover: #f2f3f6;
  --line: #e5e7eb;
  --line-strong: #d1d5db;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --faint: #9ca3af;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --accent-text: #4338ca;
  --on-accent: #ffffff;
  --ok: #059669;
  --ok-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --claude: #c2410c;
  --claude-soft: #fff7ed;
  --codebuddy: #1d4ed8;
  --codebuddy-soft: #eff6ff;
  --deepseek: #4338ca;
  --deepseek-soft: #eef2ff;
  --custom: #0f766e;
  --custom-soft: #f0fdfa;
  --google: #7c3aed;
  --google-soft: #f5f3ff;
  --code-bg: #f3f4f6;
  --code-text: #be185d;
  --pre-bg: #0f172a;
  --pre-text: #e2e8f0;
  --rail: #ffffff;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 20px 40px -12px rgba(16, 24, 40, .18), 0 4px 12px rgba(16, 24, 40, .06);
  --ring: 0 0 0 3px rgba(79, 70, 229, .16);
  --radius: 12px;
  --radius-sm: 8px;
  --mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0c10;
  --surface: #13141a;
  --surface-2: #181a21;
  --hover: #1e2029;
  --line: #262833;
  --line-strong: #353846;
  --text: #f3f4f6;
  --text-2: #d1d5db;
  --muted: #9ca3af;
  --faint: #6b7280;
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-soft: rgba(99, 102, 241, .16);
  --accent-text: #a5b4fc;
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, .12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, .12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, .12);
  --claude: #fb923c;
  --claude-soft: rgba(251, 146, 60, .12);
  --codebuddy: #93c5fd;
  --codebuddy-soft: rgba(59, 130, 246, .14);
  --deepseek: #a5b4fc;
  --deepseek-soft: rgba(99, 102, 241, .16);
  --custom: #5eead4;
  --custom-soft: rgba(20, 184, 166, .14);
  --google: #c4b5fd;
  --google-soft: rgba(139, 92, 246, .16);
  --code-bg: #1f2230;
  --code-text: #f9a8d4;
  --pre-bg: #0a0b0f;
  --pre-text: #e2e8f0;
  --rail: #101117;
  --shadow-sm: none;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .6);
  --ring: 0 0 0 3px rgba(129, 140, 248, .25);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; color: var(--text); background: var(--bg); line-height: 1.5; }
h1, h2, h3, p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code, pre, textarea { font-family: var(--mono); font-variant-ligatures: none; }
.hidden { display: none !important; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; }

/* ---------- Form controls ---------- */
input, select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: var(--ring); }
textarea { resize: vertical; font: 12.5px/1.6 var(--mono); }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; cursor: pointer; }
input[type="checkbox"] { width: 16px; height: 16px; padding: 0; accent-color: var(--accent); box-shadow: none; }
.field { display: grid; gap: 6px; margin-top: 16px; }
.field label { color: var(--text-2); font-size: 13px; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.form-grid .field { margin-top: 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.form-error, .login-error { min-height: 20px; margin-top: 8px; color: var(--danger); font-size: 13px; }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px;
  border: 1px solid transparent; border-radius: var(--radius-sm); background: var(--accent); color: var(--on-accent);
  font-weight: 600; font-size: 13.5px; line-height: 1.2; white-space: nowrap; box-shadow: var(--shadow-sm);
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.button:hover { background: var(--accent-hover); }
.button:focus-visible { outline: none; box-shadow: var(--ring); }
.button.secondary { background: var(--surface); color: var(--text-2); border-color: var(--line-strong); }
.button.secondary:hover { background: var(--hover); color: var(--text); }
.button.danger { background: var(--surface); color: var(--danger); border-color: var(--line-strong); }
.button.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.button.small { padding: 6px 11px; font-size: 12.5px; }
.button.tiny { padding: 4px 8px; font-size: 12px; border-radius: 6px; }
.button.full { width: 100%; margin-top: 18px; padding: 11px 16px; }
.button:disabled { opacity: .5; cursor: not-allowed; }
.icon-button {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 1px solid transparent;
  border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: 18px; line-height: 1;
}
.icon-button:hover { background: var(--hover); color: var(--text); }
.link-button { padding: 0; border: 0; background: none; color: var(--accent-text); font-size: 13px; font-weight: 500; }
.link-button:hover { text-decoration: underline; }
.theme-toggle { margin-left: auto; }
.theme-toggle .icon { width: 17px; height: 17px; }
/* the portal's language switch (i18n.js), before the theme toggle */
.lang-toggle { margin-left: auto; width: auto; min-width: 32px; padding: 0 6px; font-size: 12px; font-weight: 700; letter-spacing: .02em; }
.lang-toggle + .theme-toggle { margin-left: 0; }
/* an English portal waits for its texts to be swapped (i18n.js), a moment at most */
.i18n-pending body { visibility: hidden; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }

/* ---------- Login ---------- */
/* signed in last time (theme.js): no login form while the session is checked */
html[data-signed-in] .auth-shell, html[data-signed-in] .login-shell { display: none; }
.login-shell, .auth-shell {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 20px;
  background: radial-gradient(1200px 600px at 50% -10%, var(--accent-soft), transparent 70%), var(--bg);
}
.login-box, .auth-card {
  position: relative; width: min(420px, 100%); padding: 36px 36px 28px; border: 1px solid var(--line);
  border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-lg);
}
.login-box h1, .auth-card h1 { margin: 22px 0 8px; font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.25; }
.login-box > p, .auth-intro { color: var(--muted); font-size: 14px; line-height: 1.6; }
.login-help, .privacy-note, .auth-footnote { margin-top: 12px; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.login-help code { padding: 1px 5px; border-radius: 4px; background: var(--code-bg); font-size: 12px; }
.portal-link, .admin-link { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; text-align: center; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 24px 0 4px; padding: 4px; border-radius: 10px; background: var(--hover); }
.auth-tabs button { padding: 8px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-weight: 600; font-size: 13px; }
.auth-tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.auth-switch { margin: 12px 0 0; text-align: center; font-size: 13px; }
.auth-form-title { margin: 24px 0 8px; font-size: 21px; }

/* ---------- Brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
/* the 7bit logo (src/icon-192.png, design/logo.svg) */
.brand-mark {
  display: block; width: 32px; height: 32px; flex: 0 0 auto; border-radius: 9px; object-fit: cover;
  box-shadow: 0 2px 6px rgba(99, 102, 241, .35);
}
.brand strong { display: block; font-size: 14px; font-weight: 700; }
.brand span { display: block; margin-top: 1px; color: var(--muted); font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.login-brand strong { font-size: 15px; }

/* ---------- Layout ---------- */
.app { min-height: 100vh; display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 12px 14px; border-right: 1px solid var(--line); background: var(--rail); }
.rail .brand { padding: 2px 6px 18px; }
.rail .brand > div:not(.brand-mark) { min-width: 0; }
.nav { display: grid; gap: 2px; }
.nav button, .nav .nav-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font-size: 14px; font-weight: 500; text-align: left;
  transition: background .12s, color .12s;
}
.nav button .icon, .nav .nav-link .icon { width: 17px; height: 17px; opacity: .85; }
.nav button:hover, .nav .nav-link:hover { background: var(--hover); color: var(--text); }
/* the portal's way to the site's home page: a link among the menu's buttons, and the logo */
.nav .nav-link { text-decoration: none; }
.brand-home { display: block; flex: 0 0 auto; border-radius: 9px; }
.brand-home .brand-mark { transition: transform .12s; }
.brand-home:hover .brand-mark { transform: scale(1.06); }
.nav button.active { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.nav button.active .icon { opacity: 1; }
.rail-footer { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.7; }
.rail-footer strong { color: var(--text); font-size: 15px; font-weight: 700; }
#railBalance { display: inline-block; margin: 2px 0; font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.main { min-width: 0; padding: 28px clamp(18px, 3.5vw, 44px) 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.topbar h1 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.3; }
.topbar p { margin-top: 2px; color: var(--muted); font-size: 13.5px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.status { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--muted); font-size: 12.5px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.status.error, .status-error { color: var(--danger); }
.status.error::before, .status-error::before { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.notice { margin: -8px 0 20px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--muted); font-size: 13px; }
.login-notice { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; }
.login-notice > span { flex: 1; }
.notice.warn, #upstreamNotice { border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: var(--warn-soft); color: var(--warn); }
.page-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; color: var(--faint); font-size: 12px; }

/* ---------- Cards, stats, sections ---------- */
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-value { margin-top: 8px; font-size: 28px; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-note { margin-top: 6px; color: var(--muted); font-size: 12.5px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 28px 0 12px; }
.section-head h2 { font-size: 15px; font-weight: 650; }
.section-head p { color: var(--muted); font-size: 12.5px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.split > section > .section-head:first-child { margin-top: 0; }
@media (min-width: 1500px) { .split { grid-template-columns: minmax(0, 1.6fr) minmax(320px, .8fr); } }
.form-panel.split, .split:has(> .form-panel) { grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); }
.form-panel { padding: 22px 24px; }
.form-panel h2 { font-size: 16px; font-weight: 650; }
.form-panel > p, .form-panel p { margin-top: 6px; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.eyebrow { margin-bottom: 6px; color: var(--accent-text); font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 12px 16px; margin-bottom: 16px; }
.toolbar strong { font-weight: 650; }
.key-toolbar { margin-bottom: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.empty { padding: 44px 20px; color: var(--faint); font-size: 13.5px; text-align: center; }
.muted { color: var(--muted); font-size: 12.5px; }
td .muted { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.ok-text { color: var(--ok) !important; }
.danger-text { color: var(--danger) !important; }
.warn-text { color: var(--warn) !important; }
.recharge-note, .pricing-note {
  display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); font-size: 12.5px; line-height: 1.6;
}
.metric-list { display: grid; margin-top: 14px; }
.metric-row { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13.5px; }
.metric-row:last-child { border-bottom: 0; }
.metric-row strong { color: var(--text); font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; }
.metric-row code { color: var(--text-2); font-size: 12.5px; text-align: right; word-break: break-all; }
.code-block { margin: 16px 0; padding: 14px 16px; overflow: auto; border-radius: var(--radius-sm); background: var(--pre-bg); color: var(--pre-text); font: 12.5px/1.8 var(--mono); white-space: pre; }
.connect-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(290px, .85fr); gap: 20px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.panel.table-wrap, .panel > .table-wrap { border-radius: var(--radius); }
table { width: 100%; min-width: 680px; border-collapse: collapse; }
th, td { padding: 11px 16px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; font-size: 13.5px; vertical-align: middle; }
th { background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .01em; }
td { color: var(--text-2); }
td strong { color: var(--text); font-weight: 600; }
tbody tr { transition: background .1s; }
tbody tr:hover td { background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
.compact th, .compact td { padding-top: 9px; padding-bottom: 9px; }
.ledger-credit { color: var(--ok); font-weight: 600; font-variant-numeric: tabular-nums; }
.ledger-debit { color: var(--danger); font-weight: 600; font-variant-numeric: tabular-nums; }
.debit-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 14px; margin: 4px 0 0; }
.table-note { margin-top: 10px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.account-table { margin-top: 0; }
.account-table th, .account-table td { padding-left: 10px; padding-right: 10px; }
.account-table .inline-select { min-width: 84px; max-width: 112px; }
.account-table .actions { flex-wrap: wrap; gap: 6px; min-width: 152px; }
.account-table .actions .button.small { padding: 4px 8px; }

/* ---------- Pills and tags ---------- */
.pill, .tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border: 1px solid var(--line); border-radius: 99px;
  background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 500; line-height: 1.5; white-space: nowrap;
}
.tag { border-radius: 6px; }
.pill.ok { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.pill.off { border-color: transparent; background: var(--danger-soft); color: var(--danger); }
.pill.warn { border-color: transparent; background: var(--warn-soft); color: var(--warn); }
.pill.rate, .tag.rate { border-color: transparent; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.tag.claude { border-color: transparent; background: var(--claude-soft); color: var(--claude); }
.tag.openai { border-color: transparent; background: var(--ok-soft); color: var(--ok); }
.tag.codebuddy { border-color: transparent; background: var(--codebuddy-soft); color: var(--codebuddy); }
.tag.deepseek { border-color: transparent; background: var(--deepseek-soft); color: var(--deepseek); }
.tag.custom { border-color: transparent; background: var(--custom-soft); color: var(--custom); }
.tag.google { border-color: transparent; background: var(--google-soft); color: var(--google); }
/* 上游管理 → 自定义接口: the form, its model rows, 获取模型列表 / 测试连接 and their result */
.action-dialog.custom-dialog { width: min(1040px, calc(100vw - 28px)); }
.cu-head, .cu-row { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) 32px; gap: 6px; align-items: center; }
.cu-head { margin: 2px 0 6px; color: var(--muted); font-size: 12px; }
.cu-row { margin-bottom: 6px; }
.cu-row input { padding: 7px 9px; font-size: 13px; }
.cu-row input:disabled { background: var(--hover); color: var(--faint); cursor: not-allowed; }
.cu-note { grid-column: 1 / -1; margin: -2px 0 2px; font-size: 12px; }
.cu-note:empty { display: none; }
.cu-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 6px; font-size: 13px; }
.cu-spacer { flex: 1; }
.cu-result { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--hover); font-size: 13px; line-height: 1.7; }
.cu-result:empty { display: none; }
@media (max-width: 760px) {
  .cu-head { display: none; }
}
/* 模型价格: the intro with 添加模型, and the price editor */
.pricing-intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; font-size: 13.5px; line-height: 1.6; }
.pricing-intro .button { flex: none; }
.pricing-intro-actions { display: flex; flex: none; gap: 8px; }
.pricing-intro .small-lines { margin-top: 4px; font-size: 12.5px; }
.pricing-fresh { margin-bottom: 18px; border-color: color-mix(in srgb, var(--warn) 30%, var(--line)); }
.pricing-fresh .small-note.wrap { max-width: 320px; white-space: normal; }
.tag.warn-tag { border-color: transparent; background: var(--warn-soft); color: var(--warn); cursor: help; }
.price-ref { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.price-ref.hidden { display: none; }
.price-filled { margin: 6px 0 0; font-size: 12.5px; }
.pair-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.route-note { margin: 6px 0 0 !important; font-size: 12.5px !important; }
.action-dialog.price-dialog { width: min(780px, calc(100vw - 28px)); }
.price-dialog .price-head { margin: 16px 0 2px; font-size: 14px; font-weight: 650; }
.price-dialog .price-head .muted { margin-left: 6px; font-size: 12px; font-weight: 400; }
.price-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.price-grid .field { margin-top: 8px; }
.price-grid label { font-size: 12px; white-space: nowrap; }
.price-official { margin-top: 12px; font-size: 13px; line-height: 1.7; }
.price-dialog .dialog-actions { align-items: center; }
@media (max-width: 760px) { .price-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .pricing-intro { flex-direction: column; align-items: flex-start; } }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.rate-value { display: inline-flex; padding: 2px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent-text); font-size: 12.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rate-value.small { padding: 1px 7px; font-size: 11.5px; }

/* ---------- Dialogs and toast ---------- */
.action-dialog, .key-dialog {
  width: min(520px, calc(100vw - 28px)); padding: 0; border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg);
}
.wide-dialog { width: min(620px, calc(100vw - 28px)); }
/* 账号管理 → 登录记录 */
.action-dialog.auth-dialog { width: min(1000px, calc(100vw - 28px)); }
.auth-dialog .dialog-body { padding-bottom: 18px; }
.auth-dialog h3 { margin: 16px 0 10px; font-size: 14px; font-weight: 650; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 18px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 13.5px; }
.kv-grid > div > span { display: block; margin-bottom: 2px; color: var(--muted); font-size: 12px; }
.ua-raw { margin: 8px 0 0; color: var(--faint); font-family: var(--mono); font-size: 11.5px; line-height: 1.5; word-break: break-all; }
.auth-table { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.auth-table table { font-size: 13px; }
.auth-table thead th { position: sticky; top: 0; background: var(--surface); }
.auth-note { margin: 10px 0 0; font-size: 12.5px; line-height: 1.6; }
.action-dialog::backdrop, .key-dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.action-dialog form, .key-dialog form { margin: 0; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 22px 0; }
.dialog-head h2 { font-size: 17px; font-weight: 650; }
.dialog-body { padding: 8px 22px 4px; }
.dialog-body > p, .dialog-form p { margin: 10px 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.dialog-form p strong { color: var(--text); }
.dialog-form code { padding: 1px 5px; border-radius: 4px; background: var(--code-bg); font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 18px 22px 20px; }
.dialog-form .dialog-actions { padding: 18px 0 16px; }
/* openFormModal: the form is the whole dialog, its buttons need the padding the body has */
.action-dialog > form.dialog-form > .dialog-actions { padding: 18px 22px 20px; }
.check-list { display: grid; gap: 6px; max-height: 280px; overflow-y: auto; }
.check-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; font-size: 13.5px; transition: border-color .12s, background .12s; }
.check-row:hover { background: var(--surface-2); }
.check-row:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.toast {
  position: fixed; top: 18px; left: 50%; z-index: 70; max-width: min(420px, calc(100vw - 40px)); padding: 10px 16px; transform: translateX(-50%);
  border: 1px solid var(--line); border-radius: 10px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-lg);
  font-size: 13.5px; font-weight: 500; animation: toast-in .18s ease-out;
}
.toast.error { background: var(--danger); border-color: var(--danger); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, -6px); } }

/* ---------- Admin: upstreams, pricing, groups ---------- */
.upstream-toolbar .filters { display: flex; flex-wrap: wrap; gap: 8px; }
.upstream-toolbar .search-input { width: 220px; }
.upstream-toolbar select { width: auto; min-width: 128px; }
.upstream-table td { vertical-align: middle; }
.upstream-table .center { text-align: center; }
.upstream-table td:first-child { min-width: 180px; max-width: 320px; white-space: normal; overflow-wrap: anywhere; }
.upstream-table tr.fallback td { background: var(--surface-2); }
.small-note { max-width: 230px; margin-top: 3px; overflow: hidden; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.usage-cell { min-width: 230px; }
.reset-credits { margin: 3px 0 0; color: var(--muted); font-size: 12px; cursor: default; }
.reset-credits.has { color: var(--ok); font-weight: 600; }
.reset-credits .link-button { margin-left: 6px; font-weight: 500; }
/* 自动开窗 */
.warmup-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 0; font-size: 12px; cursor: default; }
.warmup-line .tag.ok-tag { padding: 1px 6px; border-color: transparent; background: var(--ok-soft); color: var(--ok); font-size: 11.5px; }
.check-row.warmup-check { grid-template-columns: auto 1fr; align-items: start; margin-top: 4px; }
.warmup-check > span { display: grid; gap: 3px; }
.warmup-check .muted { font-size: 12.5px; line-height: 1.6; }
.cred-facts { margin-top: 0; }
.cred-facts .metric-row strong { word-break: break-all; }
.cred-warning { margin: 14px 0; line-height: 1.6; }
.cred-file-head { margin: 4px 0 8px; font-size: 13px; line-height: 1.6; }
.cred-file-head code { padding: 1px 5px; border-radius: 4px; background: var(--code-bg); font-size: 12px; }
.cred-option { margin-bottom: 8px; }
.cred-file { max-height: 320px; margin: 0; padding: 12px 14px; overflow: auto; border-radius: var(--radius-sm); background: var(--pre-bg); color: var(--pre-text); font: 12px/1.55 var(--mono); white-space: pre-wrap; word-break: break-all; }
.meter-row { display: grid; grid-template-columns: 36px 72px 36px auto; align-items: center; gap: 8px; margin: 2px 0; font-size: 12px; }
.meter-label { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.meter-row .meter-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter { width: 72px; height: 6px; border: 0; border-radius: 3px; background: var(--hover); overflow: hidden; appearance: none; -webkit-appearance: none; }
.meter::-webkit-progress-bar { background: var(--hover); border-radius: 3px; }
.meter::-webkit-progress-value { background: var(--ok); border-radius: 3px; }
.meter::-moz-progress-bar { background: var(--ok); }
.meter.warm::-webkit-progress-value { background: var(--warn); }
.meter.warm::-moz-progress-bar { background: var(--warn); }
.meter.hot::-webkit-progress-value { background: var(--danger); }
.meter.hot::-moz-progress-bar { background: var(--danger); }
.meter-value { text-align: right; font-variant-numeric: tabular-nums; }
.credits-line { display: flex; align-items: baseline; gap: 8px; margin: 2px 0; font-size: 12px; font-variant-numeric: tabular-nums; }
.link-row, .row-actions { display: flex; align-items: center; gap: 12px; margin-top: 3px; font-size: 12.5px; }
.switch { position: relative; display: inline-block; width: 36px; height: 20px; }
.switch input { width: 0; height: 0; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 10px; background: var(--line-strong); cursor: pointer; transition: background .15s; }
.switch span::before { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::before { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: var(--ring); }
.inline-select { width: auto; min-width: 120px; padding: 5px 30px 5px 10px; font-size: 13px; }
.group-panel { margin-bottom: 20px; }
.group-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 14px; }
.group-head h2 { font-size: 15px; font-weight: 650; }
.group-head p { max-width: 760px; margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.group-panel .table-wrap { border-top: 1px solid var(--line); }
.group-table { min-width: 620px; }
.pricing-head { align-items: flex-start; margin: 0 0 16px; }
.pricing-head h2 { font-size: 16px; }
.pricing-head p { margin-top: 4px; }
.source-link { font-size: 13px; font-weight: 500; white-space: nowrap; }
.pricing-table { border: 1px solid var(--line); border-radius: var(--radius-sm); }
.pricing-table table { min-width: 860px; }
.pricing-table td[rowspan] { border-right: 1px solid var(--line); vertical-align: top; }
.pricing-table td { font-variant-numeric: tabular-nums; }
.pricing-secondary { margin-top: 20px; }

/* ---------- User portal: keys ---------- */
.key-table { min-width: 1080px; }
.key-table td { vertical-align: top; white-space: normal; }
.key-value { display: flex; align-items: flex-start; gap: 8px; min-width: 330px; }
.key-value code { padding: 3px 7px; border-radius: 6px; background: var(--code-bg); color: var(--text-2); font-size: 12px; line-height: 1.6; word-break: break-all; }
.note-cell { display: flex; align-items: center; gap: 8px; min-width: 150px; }
.note-cell > span { overflow-wrap: anywhere; }
.key-cell { max-width: 220px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.key-table td .pill { margin-right: 6px; }

/* A pulsing dot: something is in progress (a payment waiting, a chat log session running). */
.live-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--ok); vertical-align: 1px; animation: live-pulse 1.2s infinite ease-in-out; }
@keyframes live-pulse { 0%, 80%, 100% { opacity: .3; transform: scale(.85); } 40% { opacity: 1; transform: scale(1); } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* minmax(0, ...): a wide table in one of them scrolls in its box instead of widening the column past the screen */
  .split, .connect-grid, .split:has(> .form-panel) { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; padding: 12px 14px 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .rail .brand { padding: 0 2px 10px; }
  .nav { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
  .nav button, .nav .nav-link { flex: 0 0 auto; padding: 7px 11px; font-size: 13.5px; }
  .nav button .icon, .nav .nav-link .icon { display: none; }
  .rail-footer { display: none; }
  .main { padding: 20px 16px 32px; }
}
@media (max-width: 640px) {
  .login-box, .auth-card { padding: 28px 22px 22px; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .top-actions { justify-content: flex-start; }
  .stats { gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat-value { font-size: 22px; }
  .form-grid { grid-template-columns: 1fr; }
  .page-footer { flex-direction: column; gap: 4px; }
  .metric-row { flex-direction: column; gap: 4px; }
  .metric-row strong, .metric-row code { text-align: left; }
  .group-head { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* Usage filters */
.filter-bar { margin-bottom: 16px; padding: 16px 18px; overflow: visible; }
.filter-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.filter-grid .field { margin-top: 0; }
.filter-grid .field > span { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.filter-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-button { padding: 5px 12px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.chip-button:hover { background: var(--hover); }
.chip-button.active { border-color: transparent; background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.usage-stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.usage-stats .stat { padding: 14px 18px; }
.usage-stats .stat-value { font-size: 22px; }
.hit-note { margin-top: 2px; font-size: 12px; white-space: nowrap; }
@media (max-width: 1100px) { .usage-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .usage-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.is-loading { opacity: .55; transition: opacity .15s; }
input[type="date"] { min-height: 38px; }
@media (max-width: 1100px) { .filter-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) { .filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .filter-grid input, .filter-grid select { min-width: 0; } }
@media (max-width: 420px) { .filter-grid { grid-template-columns: minmax(0, 1fr); } }
.cost-cell { cursor: help; font-variant-numeric: tabular-nums; }

/* claude-pro guide */
.guide-step { margin-top: 26px; }
.guide-list { margin: 12px 0 0; padding-left: 20px; color: var(--text-2); font-size: 13.5px; line-height: 1.9; }
.command-block { display: flex; align-items: center; gap: 10px; margin: 12px 0; padding: 10px 10px 10px 16px; border-radius: var(--radius-sm); background: var(--pre-bg); }
.command-block pre { flex: 1; min-width: 0; margin: 0; overflow-x: auto; color: var(--pre-text); font: 13px/1.6 var(--mono); }
.command-block .button { flex: 0 0 auto; }
.form-panel p code { padding: 1px 5px; border-radius: 4px; background: var(--code-bg); font-size: 12.5px; }

/* Connect page */
.connect-head { margin-bottom: 16px; }
.connect-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.connect-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; gap: 3px; padding: 3px; border-radius: 10px; background: var(--hover); }
.seg-large { display: flex; margin-top: 18px; }
.seg-large .seg-button { flex: 1; padding: 9px 14px; font-size: 14px; }
.seg-button { padding: 6px 12px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.seg-button.small { padding: 5px 10px; font-size: 12.5px; }
.seg-button:hover { color: var(--text); }
.seg-button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.setup-steps { margin: 0; padding: 0; list-style: none; }
.setup-step { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 14px; padding-bottom: 22px; }
.setup-step:not(:last-child)::before { content: ""; position: absolute; top: 34px; bottom: 4px; left: 15px; width: 2px; background: var(--line); }
.setup-num { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-text); font-weight: 700; }
.setup-body { min-width: 0; padding-top: 4px; }
.setup-body h3 { font-size: 15px; font-weight: 650; }
.setup-body p, .connect-body > p { margin-top: 6px; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.setup-body p code, .connect-body p code, .connect-more code { padding: 1px 5px; border-radius: 4px; background: var(--code-bg); font-size: 12.5px; }
.command-block { align-items: flex-start; }
.command-block pre { white-space: pre; }
.command-block.labeled { position: relative; padding-top: 28px; }
.command-label { position: absolute; top: 8px; left: 16px; color: #94a3b8; font: 11px var(--mono); letter-spacing: .04em; }
.connect-more { margin-top: 4px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.connect-more summary { color: var(--text-2); font-size: 13.5px; font-weight: 600; cursor: pointer; }
.docs-section { margin-top: 20px; }
.docs-section h3 { margin-top: 18px; font-size: 14px; font-weight: 650; }
.docs-endpoint-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.docs-path { color: var(--text); font: 650 15px var(--mono); word-break: break-all; }
.docs-method { display: inline-block; min-width: 46px; padding: 2px 7px; border-radius: 5px; font: 700 11.5px/1.5 var(--mono); text-align: center; }
.docs-method.get { background: var(--ok-soft); color: var(--ok); }
.docs-method.post { background: var(--accent-soft); color: var(--accent-text); }
.docs-section .docs-table { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.docs-table table { min-width: 0; }
.docs-table th, .docs-table td { white-space: normal; vertical-align: top; line-height: 1.6; }
@media (min-width: 901px) { .docs-table td:first-child { white-space: nowrap; } }
.docs-table td code { padding: 1px 5px; border-radius: 4px; background: var(--code-bg); font-size: 12.5px; word-break: break-word; }
.docs-link { padding: 0; border: 0; background: none; color: var(--accent-text); font: 600 13px var(--mono); cursor: pointer; }
.docs-link:hover { text-decoration: underline; }
.docs-try { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.docs-output { max-height: 420px; margin: 10px 0 0; padding: 12px 16px; overflow: auto; border-radius: var(--radius-sm); background: var(--pre-bg); color: var(--pre-text); font: 12.5px/1.6 var(--mono); white-space: pre; }
.docs-output[hidden] { display: none; }
.connect-endpoints { margin-top: 0; }
.connect-endpoints code { word-break: break-all; }
.connect-tip { margin-top: 16px; padding: 14px 18px; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--muted); font-size: 13.5px; }
.connect-tip strong { color: var(--text); }
@media (max-width: 640px) { .seg-large { flex-wrap: wrap; } .setup-step { grid-template-columns: 26px minmax(0, 1fr); gap: 10px; } .setup-num { width: 26px; height: 26px; font-size: 13px; } .setup-step:not(:last-child)::before { left: 12px; top: 28px; } }
.pricing-rates { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.pricing-rates .stat-value { display: flex; gap: 6px; flex-wrap: wrap; font-size: 20px; }
.pricing-rates .rate-value { font-size: 16px; padding: 3px 12px; }
.pill.has-tip { cursor: help; }
.tip-mark { display: inline-grid; place-items: center; width: 13px; height: 13px; margin-left: 4px; border: 1.5px solid currentColor; border-radius: 50%; font-size: 9px; font-weight: 800; line-height: 1; }
.status-reason { max-width: 220px; margin-top: 3px; overflow: hidden; color: var(--danger); font-size: 11.5px; white-space: nowrap; text-overflow: ellipsis; }
input[type="datetime-local"] { min-height: 38px; }

/* Settings (配置管理) */
.settings-tabs { margin-bottom: 18px; }
.settings-card { margin-bottom: 18px; }
.settings-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 6px; }
.settings-card-head h2 { display: flex; align-items: center; gap: 8px; }
.settings-card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
.settings-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.settings-card .field > span { color: var(--text-2); font-size: 13px; font-weight: 500; }
.settings-card .field small { line-height: 1.5; }
.settings-card textarea { font-size: 12px; }
.settings-switch { display: flex; align-items: center; gap: 12px; margin-top: 14px; cursor: pointer; }
.settings-switch strong { display: block; font-size: 13.5px; font-weight: 600; }
.settings-switch small { display: block; }
.settings-urls { display: grid; gap: 6px; margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; }
.settings-urls div { display: flex; gap: 12px; flex-wrap: wrap; }
.settings-urls span { min-width: 110px; color: var(--muted); }
.settings-urls code { word-break: break-all; }
.brand-dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.brand-dot.alipay, .tag.alipay { background: #1677ff; }
.brand-dot.wechat, .tag.wechat { background: #07c160; }
.tag.alipay, .tag.wechat { border-color: transparent; color: #fff; }
.test-mail { display: flex; gap: 8px; margin-top: 12px; max-width: 520px; }
/* 配置管理 → CodeBuddy: the model table */
.scheduler-tiers { margin-top: 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.scheduler-tiers td { vertical-align: top; }
.scheduler-tiers input, .scheduler-tiers select { width: 100%; min-width: 84px; }
.scheduler-tiers .small-note.wrap { max-width: none; white-space: normal; }
#schedulerForm h3 { margin: 22px 0 4px; font-size: 14px; }
.codebuddy-models { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.codebuddy-models td { vertical-align: middle; }
.codebuddy-models .center { text-align: center; }
.codebuddy-models tr.muted-row td { opacity: .6; }
.inline-number { width: 84px; padding: 5px 8px; font-size: 13px; }
.settings-subhead { margin: 20px 0 4px; font-size: 14px; font-weight: 650; }
@media (max-width: 1100px) { .settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .settings-grid { grid-template-columns: 1fr; } .settings-card-head { flex-direction: column; } }

/* Registration code */
.code-row { display: flex; gap: 8px; }
.code-row input { flex: 1; min-width: 0; letter-spacing: .2em; }
.code-row .button { flex: 0 0 auto; min-width: 116px; }

/* Recharge (QR payments) */
.field-label { color: var(--text-2); font-size: 13px; font-weight: 500; }
.amount-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.amount-chip { display: grid; gap: 2px; padding: 12px 10px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-align: center; transition: border-color .12s, background .12s; }
.amount-chip strong { font-size: 18px; font-weight: 700; }
.amount-chip small { color: var(--muted); font-size: 12px; }
.amount-chip:hover { border-color: var(--line-strong); }
.amount-chip.active { border-color: var(--accent); background: var(--accent-soft); }
.amount-chip.active small { color: var(--accent-text); }
.channel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.channel-option { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); text-align: left; }
.channel-option strong { display: block; font-size: 14px; }
.channel-option small { color: var(--muted); font-size: 12px; }
.channel-option.alipay.active { border-color: #1677ff; background: rgba(22, 119, 255, .07); }
.channel-option.wechat.active { border-color: #07c160; background: rgba(7, 193, 96, .07); }
.channel-logo { display: inline-grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 8px; color: #fff; font-size: 14px; font-weight: 800; }
.channel-logo.alipay { background: #1677ff; }
.channel-logo.wechat { background: #07c160; }
.pay-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 14px; }
.pay-summary strong { font-size: 18px; }
/* 充值活动 on 充值余额: the banner, the gift on each amount, the nudge to the next tier and the summary */
.promo-banner { margin: 4px 0 18px; padding: 14px 16px; border-radius: var(--radius-sm); color: #fff; background: linear-gradient(115deg, #4f46e5 0%, #7c3aed 55%, #db2777 100%); box-shadow: 0 10px 30px -14px rgba(124, 58, 237, .7); }
.promo-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; font-size: 16px; }
.promo-gift { font-size: 20px; }
.promo-ends { margin-left: auto; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .18); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.promo-tiers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.promo-tiers span { padding: 5px 12px; border-radius: 999px; background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28); font-size: 13.5px; }
.promo-tiers b { font-weight: 700; }
.promo-first { margin-top: 10px; font-size: 13.5px; opacity: .95; }
.amount-chip { position: relative; }
.amount-chip .chip-badge { position: absolute; top: -9px; right: -6px; padding: 2px 8px; border-radius: 999px; background: linear-gradient(90deg, #f43f5e, #f97316); color: #fff; font-size: 11px; font-weight: 700; line-height: 1.5; box-shadow: 0 4px 10px -4px rgba(244, 63, 94, .8); }
.amount-chip .chip-gift { justify-self: center; margin-top: 3px; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, #f43f5e 12%, transparent); color: #e11d48; font-size: 11.5px; font-style: normal; font-weight: 600; }
:root[data-theme="dark"] .amount-chip .chip-gift { color: #fda4af; }
.pay-nudge { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 14px; padding: 10px 14px; border: 1px dashed color-mix(in srgb, #f97316 55%, transparent); border-radius: var(--radius-sm); background: color-mix(in srgb, #f97316 8%, transparent); font-size: 13.5px; }
.pay-nudge b { color: #ea580c; }
.pay-summary .pay-total { color: var(--ok); }
.pay-breakdown { color: var(--muted); font-size: 12.5px; }
/* 低余额提醒 on 概览 */
.low-balance { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid color-mix(in srgb, #f97316 40%, transparent); background: color-mix(in srgb, #f97316 9%, var(--surface)); font-size: 13.5px; }
.low-balance > span:nth-child(2) { flex: 1; }
.low-balance-icon { font-size: 18px; }
/* 配置管理 → 充值活动 */
.promo-tier-table td { vertical-align: middle; }
.promo-tier-table input { max-width: 160px; }
.input-affix { display: flex; align-items: center; gap: 6px; }
.input-affix > span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.form-actions.start { justify-content: flex-start; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; }
.pay-dialog { width: min(400px, calc(100vw - 28px)); }

/* 兑换码: the portal's 兑换 page and the admin's list and generator */
.redeem-page { display: grid; gap: 20px; max-width: 720px; margin: 0 auto; }
.redeem-hero { display: grid; justify-items: center; gap: 6px; padding: 32px 20px; border-radius: var(--radius); background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 72%, #000)); color: #fff; text-align: center; box-shadow: var(--shadow); }
.redeem-hero-icon { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 8px; border-radius: 14px; background: rgba(255, 255, 255, .18); }
.redeem-hero-icon .icon { width: 26px; height: 26px; }
.redeem-hero > span { font-size: 13.5px; opacity: .88; }
.redeem-hero > strong { font-size: 40px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.redeem-hero > small { font-size: 12.5px; opacity: .85; }
.redeem-page .form-panel .field { margin-top: 0; }
.redeem-input { position: relative; margin-top: 8px; }
.redeem-input .icon { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.redeem-input input { padding: 13px 14px 13px 44px; font-size: 16px; font-family: var(--mono); letter-spacing: .06em; }
.redeem-input input::placeholder { font-family: inherit; letter-spacing: 0; }
.form-panel p.redeem-hint { margin-top: 8px; color: var(--faint); font-size: 12.5px; }
.redeem-submit .icon { width: 18px; height: 18px; }
.redeem-info { display: flex; gap: 14px; padding: 18px 20px; border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-text); font-size: 13.5px; }
.redeem-info-icon { display: grid; place-items: center; flex: 0 0 auto; width: 30px; height: 30px; border: 1.5px solid currentColor; border-radius: 50%; font: 700 14px/1 Georgia, serif; }
.redeem-info strong { display: block; margin-bottom: 6px; font-weight: 650; }
.redeem-info ul { margin: 0; padding-left: 18px; line-height: 1.9; }
.redeem-history-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.redeem-history-head h2 { font-size: 15px; font-weight: 650; }
.redeem-history { display: grid; gap: 10px; margin: 0; padding: 14px; list-style: none; }
.redeem-history li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); }
.redeem-history-icon { display: grid; place-items: center; flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; background: var(--ok-soft); color: var(--ok); font-weight: 700; }
.redeem-history-main { display: grid; gap: 2px; flex: 1; min-width: 0; }
.redeem-history-main small, .redeem-history-amount small { color: var(--muted); font-size: 12px; }
.redeem-history-amount { display: grid; gap: 2px; justify-items: end; text-align: right; }
.redeem-history-amount strong { color: var(--ok); font-variant-numeric: tabular-nums; }
.redeem-code-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.redeem-code-cell code { padding: 3px 7px; border-radius: 6px; background: var(--code-bg); color: var(--text-2); font-size: 12.5px; letter-spacing: .03em; }
#redeemFilter .filters { display: flex; flex-wrap: wrap; gap: 8px; }
#redeemFilter select { width: auto; min-width: 120px; }
#redeemFilter .search-input { width: 280px; max-width: 100%; }
.expiry-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.expiry-grid .amount-chip { padding: 10px 6px; }
.expiry-grid .amount-chip strong { font-size: 13.5px; font-weight: 600; }
.redeem-dialog #rdExpires { margin-top: 8px; }
@media (max-width: 640px) {
  .expiry-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .redeem-hero > strong { font-size: 34px; }
  .redeem-history-amount small { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
}
.pay-qr { text-align: center; }
.pay-amount { font-size: 32px; font-weight: 800; letter-spacing: -.02em; }
.pay-credit { color: var(--muted); font-size: 13px; }
.pay-qr-box { display: inline-block; margin: 16px auto 6px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.pay-qr-box svg { display: block; }
.pay-qr.alipay .pay-qr-box { border-color: rgba(22, 119, 255, .4); }
.pay-qr.wechat .pay-qr-box { border-color: rgba(7, 193, 96, .4); }
.pay-scan { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; font-size: 14px; font-weight: 600; }
.pay-scan .channel-logo { width: 22px; height: 22px; font-size: 11px; border-radius: 6px; }
.pay-open { margin-top: 10px; }
.pay-status { margin-top: 10px; color: var(--muted); font-size: 13px; }
.pay-order { margin-top: 4px; font-size: 11.5px; }
.pay-qr .dialog-actions { justify-content: center; padding-bottom: 6px; }
.pay-result { padding: 18px 0 14px; text-align: center; }
.pay-result-icon { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%; background: var(--hover); color: var(--muted); font-size: 28px; font-weight: 800; }
.pay-result.ok .pay-result-icon { background: var(--ok-soft); color: var(--ok); }
.pay-result h3 { font-size: 18px; }
.pay-result p { margin: 8px 0 18px; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.tag.alipay, .tag.wechat { border-color: transparent; color: #fff; }
@media (max-width: 640px) { .amount-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.settings-grid { align-items: start; }
.settings-card .field, .form-panel .field { align-content: start; }

/* ---------- User portal: phone layout (drawer navigation, tables as cards) ---------- */
.mobile-bar, .rail-backdrop { display: none; }
@media (max-width: 900px) {
  .app.drawer-nav { display: block; }
  .app.drawer-nav .mobile-bar {
    position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 10px;
    min-height: calc(52px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) max(14px, env(safe-area-inset-right)) 0 max(6px, env(safe-area-inset-left));
    border-bottom: 1px solid var(--line); background: var(--rail);
  }
  .mobile-bar .nav-toggle { width: 42px; height: 42px; color: var(--text); }
  .mobile-bar .nav-toggle .icon { width: 22px; height: 22px; }
  .mobile-bar .brand-mark { width: 28px; height: 28px; border-radius: 8px; font-size: 13px; }
  .mobile-bar strong { flex: 1; min-width: 0; overflow: hidden; font-size: 15.5px; font-weight: 650; white-space: nowrap; text-overflow: ellipsis; }
  .mobile-balance { flex: 0 0 auto; color: var(--muted); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .app.drawer-nav .rail {
    position: fixed; inset: 0 auto 0 0; z-index: 41; width: min(290px, 85vw); height: 100%;
    padding: calc(16px + env(safe-area-inset-top)) 12px calc(14px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    border-right: 1px solid var(--line); border-bottom: 0; overflow-y: auto; overscroll-behavior: contain;
    visibility: hidden; transform: translateX(-105%); transition: transform .2s ease, visibility .2s; box-shadow: var(--shadow-lg);
  }
  .app.drawer-nav.nav-open .rail { visibility: visible; transform: none; }
  .app.drawer-nav.nav-open .rail-backdrop { position: fixed; inset: 0; z-index: 40; display: block; background: rgba(15, 23, 42, .45); }
  .app.drawer-nav .rail .brand { padding: 2px 6px 16px; }
  .app.drawer-nav .nav { display: grid; gap: 2px; overflow: visible; }
  .app.drawer-nav .nav button, .app.drawer-nav .nav .nav-link { padding: 11px 12px; font-size: 15px; }
  .app.drawer-nav .nav button .icon, .app.drawer-nav .nav .nav-link .icon { display: block; width: 19px; height: 19px; }
  .app.drawer-nav .rail-footer { display: block; }
  .app.drawer-nav .main { padding: 18px max(14px, env(safe-area-inset-right)) calc(28px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left)); }
  .app.drawer-nav .topbar { margin-bottom: 18px; }
  .app.drawer-nav .topbar h1 { display: none; }
  body.nav-locked { overflow: hidden; }
}
/* Phones zoom into form fields whose text is smaller than 16px. */
@media (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { font-size: 16px !important; }
}
@media (max-width: 640px) {
  .table-wrap > table.cards { min-width: 0; }
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr { display: block; width: 100%; }
  table.cards tr { padding: 10px 14px; border-bottom: 1px solid var(--line); }
  table.cards tr:last-child { border-bottom: 0; }
  table.cards td { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 14px; padding: 3px 0; border: 0; overflow-wrap: anywhere; white-space: normal; text-align: right; font-size: 13.5px; }
  table.cards td::before { content: attr(data-label); flex: 0 0 auto; max-width: 45%; color: var(--muted); font: 500 12.5px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; text-align: left; }
  table.cards td:not([data-label])::before { content: none; }
  table.cards tbody tr:hover td { background: transparent; }
  table.cards .key-value, table.cards .note-cell { justify-content: flex-end; min-width: 0; }
  table.cards .key-cell, table.cards .status-reason { max-width: 100%; white-space: normal; }
  .pager { justify-content: center; }
  .pager .actions { justify-content: center; }
  .pricing-head { flex-direction: column; gap: 6px; }
}
.form-panel > .notice { margin: 12px 0 0; }

/* ---------- Admin: chat logs (聊天记录) ---------- */
.cl-filter-row { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.cl-filter-row .field { min-width: 220px; margin-top: 0; }
.cl-filter-row .field > span { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.cl-filter-row .cl-search { flex: 1; }
.cl-status { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; color: var(--muted); font-size: 12.5px; }
.cl-sep { color: var(--faint); }
.cl-table td { vertical-align: top; }
.cl-row { cursor: pointer; }
.cl-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cl-title-cell { min-width: 240px; max-width: 440px; white-space: normal !important; }
.cl-title-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.cl-title-line strong { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cl-ellipsis { min-width: 0; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cl-title-cell .cl-ellipsis { max-width: 420px; }
.cl-id-line { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; margin-top: 2px; }
.cl-copy-id { flex: 0 0 auto; padding: 1px 6px; font-size: 11px; line-height: 1.5; }
.cl-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; padding: 12px 16px; overflow: visible; }
.cl-head-main { flex: 1; min-width: 220px; }
.cl-head-title { display: block; overflow: hidden; font-size: 15px; white-space: nowrap; text-overflow: ellipsis; }
.cl-head-stats { display: flex; flex-wrap: wrap; gap: 14px; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.cl-head-stats strong { color: var(--text); font-weight: 650; }
.cl-view { display: grid; grid-template-columns: minmax(270px, 350px) minmax(0, 1fr); gap: 16px; align-items: start; }
.cl-requests { position: sticky; top: 14px; max-height: calc(100vh - 28px); padding: 6px; overflow-y: auto; overscroll-behavior: contain; }
.cl-req { display: grid; gap: 3px; width: 100%; padding: 9px 10px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--text-2); font-size: 12.5px; text-align: left; }
.cl-req + .cl-req { margin-top: 2px; }
.cl-req:hover { background: var(--hover); }
.cl-req.active { border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }
.cl-req-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.cl-req-num { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.cl-req-model { flex: 1; min-width: 0; overflow: hidden; color: var(--muted); font: 11.5px var(--mono); white-space: nowrap; text-overflow: ellipsis; }
.cl-req-time { color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.cl-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--faint); }
.cl-dot.ok { background: var(--ok); }
.cl-dot.warn { background: var(--warn); }
.cl-dot.err { background: var(--danger); }
.cl-dot.run { background: var(--warn); animation: live-pulse 1.2s infinite ease-in-out; }
.cl-req-preview { display: -webkit-box; overflow: hidden; color: var(--text); line-height: 1.45; overflow-wrap: anywhere; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cl-req-reply { overflow: hidden; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.cl-req-reply.error { color: var(--danger); }
.cl-req-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; color: var(--faint); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.cl-detail { min-height: 420px; padding: 16px 20px 20px; overflow: visible; transition: opacity .15s; }
.cl-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.cl-detail-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; font-size: 14px; }
.cl-detail-title strong { font-size: 16px; }
.cl-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; margin: 12px 0; }
.cl-fact { min-width: 0; padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.cl-fact > span { display: block; color: var(--muted); font-size: 11.5px; }
.cl-fact > strong { display: block; margin-top: 2px; overflow: hidden; font-size: 13px; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.cl-tabs { display: flex; flex-wrap: wrap; margin: 4px 0 12px; }
.cl-changed-dot { display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-radius: 50%; background: var(--accent); vertical-align: 2px; }
.cl-notice { margin: 4px 0 10px; padding: 8px 12px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent-text); font-size: 13px; }
.cl-notice.same { background: var(--surface-2); color: var(--muted); }
.cl-collapsed { display: block; width: 100%; margin: 10px 0; padding: 9px 12px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 13px; text-align: center; }
.cl-collapsed:hover { border-color: var(--accent); color: var(--accent-text); }
.cl-msg, .cl-sys { margin: 10px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.cl-msg-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 6px 12px; border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; background: var(--surface-2); font-size: 12.5px; }
.cl-role { font-weight: 700; }
.cl-msg.user .cl-role { color: var(--accent-text); }
.cl-msg.assistant .cl-role { color: var(--claude); }
.cl-msg.tool .cl-role { color: var(--ok); }
.cl-msg.new { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: inset 3px 0 0 var(--accent); }
.cl-msg.response { border-color: color-mix(in srgb, var(--ok) 50%, var(--line)); box-shadow: inset 3px 0 0 var(--ok); }
.cl-msg.response .cl-role { color: var(--ok); }
.cl-sys.changed { box-shadow: inset 3px 0 0 var(--accent); }
.cl-msg-body { display: grid; gap: 8px; min-width: 0; padding: 10px 12px; }
.cl-msg-body > .tag, .cl-call > .tag { justify-self: start; }
.cl-text { position: relative; color: var(--text); font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.cl-text.clamp, .cl-json.clamp { max-height: 300px; overflow: hidden; padding-bottom: 30px; }
.cl-text.clamp.open, .cl-json.clamp.open { max-height: none; }
.cl-expand { position: absolute; right: 0; bottom: 0; left: 0; padding: 18px 0 6px; border: 0; background: linear-gradient(transparent, var(--surface) 60%); color: var(--accent-text); font: 600 12.5px Inter, ui-sans-serif, system-ui, sans-serif; text-align: center; }
.cl-json .cl-expand { background: linear-gradient(transparent, var(--surface-2) 60%); }
.open > .cl-expand { position: static; display: block; width: 100%; padding: 6px 0 0; background: none; }
.cl-json { position: relative; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.cl-json pre { margin: 0; padding: 9px 12px; overflow-x: auto; color: var(--text-2); font: 12px/1.55 var(--mono); white-space: pre; }
.cl-reminder, .cl-thinking { padding-left: 10px; border-left: 2px solid var(--line-strong); color: var(--muted); }
.cl-reminder summary, .cl-thinking summary { font-size: 12.5px; cursor: pointer; }
.cl-reminder .cl-text, .cl-thinking .cl-text { margin-top: 6px; color: var(--muted); font-size: 13px; }
.cl-call, .cl-result { display: grid; gap: 6px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); }
.cl-result { border-left-color: var(--ok); }
.cl-result.error { border-left-color: var(--danger); }
.cl-result .cl-text { font: 12.5px/1.55 var(--mono); tab-size: 4; }
.cl-call-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--text-2); font-size: 12.5px; }
.cl-call-mark { color: var(--faint); }
.cl-media { display: inline-flex; align-items: center; gap: 8px; width: fit-content; max-width: 100%; padding: 6px 10px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.cl-media-icon { padding: 1px 5px; border-radius: 4px; background: var(--accent-soft); color: var(--accent-text); font: 700 10px var(--mono); }
.cl-image { max-width: min(360px, 100%); max-height: 280px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.tag.cl-cache { border-color: transparent; background: var(--warn-soft); color: var(--warn); font: 11px var(--mono); }
.cl-error { padding: 8px 12px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--danger); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cl-detail > .cl-error { margin-bottom: 10px; }
.cl-note { color: var(--muted); font-size: 12.5px; font-style: italic; }
.cl-out { display: grid; gap: 4px; }
.cl-out-label { font-size: 11.5px; }
.cl-diff-wrap summary { margin-bottom: 6px; color: var(--accent-text); font-size: 12.5px; cursor: pointer; }
.cl-diff { max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font: 12px/1.55 var(--mono); }
.cl-diff-line { display: grid; grid-template-columns: 22px minmax(0, 1fr); padding-right: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cl-diff-line > span { color: var(--faint); text-align: center; user-select: none; }
.cl-diff-line.add { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--text); }
.cl-diff-line.del { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--text); }
.cl-diff-skip { padding: 1px 10px; background: var(--surface); color: var(--faint); font-style: italic; }
.cl-tooldef { margin: 8px 0; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.cl-tooldef.changed { box-shadow: inset 3px 0 0 var(--accent); }
.cl-tooldef summary { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px 12px; list-style: none; cursor: pointer; }
.cl-tooldef summary::-webkit-details-marker { display: none; }
.cl-tooldef summary::before { content: "▸"; color: var(--faint); }
.cl-tooldef[open] summary::before { content: "▾"; }
.cl-tooldef > :not(summary) { margin: 0 12px 10px; }
.cl-h3 { margin: 16px 0 8px; font-size: 13.5px; font-weight: 650; }
.cl-h3:first-child { margin-top: 4px; }
.cl-h3 .muted { margin-left: 6px; font-weight: 400; }
table.cl-kv { min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); border-collapse: separate; border-spacing: 0; overflow: hidden; }
.cl-kv th { width: 210px; color: var(--text-2); font-size: 12.5px; vertical-align: top; white-space: normal; overflow-wrap: anywhere; }
.cl-kv td { font-size: 12.5px; white-space: normal; overflow-wrap: anywhere; }
.cl-kv tbody tr:hover td, .cl-kv tr:hover td { background: transparent; }
.cl-inline-json { max-height: 300px; margin: 0; overflow: auto; font: 12px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.cl-raw-head { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 6px; }
.cl-raw-head:first-child { margin-top: 0; }
.cl-raw { max-height: 60vh; margin: 0; padding: 12px 14px; overflow: auto; border-radius: var(--radius-sm); background: var(--pre-bg); color: var(--pre-text); font: 12px/1.55 var(--mono); white-space: pre; }
@media (max-width: 1100px) {
  .cl-view { grid-template-columns: minmax(0, 1fr); }
  .cl-requests { position: static; max-height: 42vh; }
}
@media (max-width: 640px) {
  .cl-detail { padding: 12px; }
  .cl-kv th { width: 120px; }
}

/* ---------- Suppliers (供应商): the portal page and the admin's account tag ---------- */
.owner-tag { margin-top: 4px; }
.supplier-notice { margin: 0 0 18px; line-height: 1.7; }
.supplier-notice strong { color: var(--accent-text); }
.supplier-earnings-head { align-items: center; }
.supplier-earnings-head .inline-select { max-width: 220px; }
@media (max-width: 640px) { .supplier-earnings-head { flex-direction: column; align-items: stretch; } .supplier-earnings-head .inline-select { max-width: none; } }

/* ---------- 在线客服: the portal's button and panel, the console's 客服管理 (message bubbles are shared) ---------- */
.nav-badge { min-width: 18px; margin-left: auto; padding: 0 6px; border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; }
.support-fab {
  position: fixed; right: max(20px, calc(env(safe-area-inset-right) + 12px)); bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px)); z-index: 50;
  display: grid; place-items: center; width: 54px; height: 54px; padding: 0; border: 0; border-radius: 50%;
  background: var(--accent); color: #fff; box-shadow: 0 8px 24px rgba(79, 70, 229, .35); transition: transform .15s, background .15s;
}
.support-fab:hover { background: var(--accent-hover); transform: translateY(-1px); }
.support-fab .icon { width: 25px; height: 25px; }
.support-badge { position: absolute; top: -3px; right: -3px; min-width: 20px; height: 20px; padding: 0 6px; border: 2px solid var(--bg); border-radius: 99px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; line-height: 16px; }
.app.hidden ~ .support-fab, .app.nav-open ~ .support-fab, .app.hidden ~ .support-panel { display: none; }
.support-panel {
  position: fixed; right: max(20px, calc(env(safe-area-inset-right) + 12px)); bottom: calc(max(20px, calc(env(safe-area-inset-bottom) + 12px)) + 66px); z-index: 55;
  display: flex; flex-direction: column; width: min(390px, calc(100vw - 40px)); height: min(620px, calc(100vh - 130px)); overflow: hidden;
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-lg); animation: support-in .16s ease-out;
}
@keyframes support-in { from { opacity: 0; transform: translateY(8px); } }
.support-head { display: flex; align-items: center; gap: 10px; padding: 12px 10px 12px 16px; border-bottom: 1px solid var(--line); }
.support-head-text { flex: 1; min-width: 0; }
.support-head-text strong { display: block; font-size: 15px; }
.support-head-text small { color: var(--muted); font-size: 12px; }
.support-avatar, .sd-avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 50%; background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; font-size: 14px; font-weight: 700; }
.support-avatar.small, .sd-avatar.small { width: 28px; height: 28px; font-size: 12px; }
.support-log, .sd-log { display: flex; flex: 1; flex-direction: column; gap: 10px; min-height: 0; padding: 14px; overflow-y: auto; overscroll-behavior: contain; background: var(--surface-2); }
.support-time { align-self: center; color: var(--faint); font-size: 11.5px; }
.support-msg { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.support-msg.mine { justify-content: flex-end; }
.support-bubble-wrap { display: grid; gap: 6px; min-width: 0; max-width: 78%; }
.support-msg.mine .support-bubble-wrap { justify-items: end; }
.support-bubble { padding: 9px 12px; border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; background: var(--surface); color: var(--text); font-size: 14px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.support-msg.mine .support-bubble { border-color: transparent; border-radius: 14px 14px 4px 14px; background: var(--accent); color: #fff; }
.support-msg.mine .support-bubble a { color: #fff; text-decoration: underline; }
.support-images { display: flex; flex-wrap: wrap; gap: 6px; }
.support-msg.mine .support-images { justify-content: flex-end; }
.support-image { padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: zoom-in; }
.support-image img { display: block; max-width: 200px; max-height: 200px; object-fit: cover; }
.support-receipt, .sd-receipt { color: var(--faint); font-size: 11.5px; }
.support-receipt { align-self: flex-end; margin-top: -4px; }
.support-closed { padding: 8px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 13px; text-align: center; }
.support-composer, .sd-composer { padding: 10px 12px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.support-composer.disabled { opacity: .5; pointer-events: none; }
.support-attachments { display: flex; flex-wrap: wrap; gap: 8px; }
.support-attachments:not(:empty) { margin-bottom: 8px; }
.support-attachment { position: relative; }
.support-attachment img { display: block; width: 56px; height: 56px; border: 1px solid var(--line); border-radius: 8px; object-fit: cover; }
.support-attachment button { position: absolute; top: -6px; right: -6px; display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: var(--text); color: var(--bg); font-size: 13px; line-height: 1; }
.support-input-row { display: flex; align-items: flex-end; gap: 6px; }
.support-input-row textarea { flex: 1; min-height: 38px; max-height: 140px; padding: 8px 10px; border-radius: 10px; font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; resize: none; }
.support-tool, .support-send { display: grid; place-items: center; width: 38px; height: 38px; flex: none; padding: 0; border: 0; border-radius: 10px; }
.support-tool { background: transparent; color: var(--muted); }
.support-tool:hover { background: var(--hover); color: var(--text); }
.support-send { background: var(--accent); color: #fff; }
.support-send:hover { background: var(--accent-hover); }
.support-send:disabled { opacity: .5; }
.support-send .icon, .support-tool .icon { width: 19px; height: 19px; }
.support-lightbox { z-index: 65; }
@media (max-width: 640px) {
  .support-panel {
    inset: 0; width: auto; height: auto; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
    border: 0; border-radius: 0; animation: none;
  }
  .support-composer { padding-bottom: max(12px, env(safe-area-inset-bottom)); }
  .support-fab.open { display: none; }
  .support-image img { max-width: 160px; max-height: 160px; }
  body.support-locked { overflow: hidden; }
}
.sd-toolbar .actions { gap: 8px; }
.sd-search { width: 190px; padding: 6px 10px; font-size: 13px; }
.sd-view { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); gap: 16px; align-items: stretch; height: calc(100vh - 210px); min-height: 460px; }
.sd-threads { padding: 6px; overflow-y: auto; }
.sd-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--text-2); text-align: left; }
.sd-item + .sd-item { margin-top: 2px; }
.sd-item:hover { background: var(--hover); }
.sd-item.active { border-color: color-mix(in srgb, var(--accent) 35%, transparent); background: var(--accent-soft); }
.sd-item-main { display: grid; flex: 1; gap: 2px; min-width: 0; }
.sd-item-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.sd-item-top strong { flex: 1; min-width: 0; overflow: hidden; color: var(--text); font-size: 13.5px; white-space: nowrap; text-overflow: ellipsis; }
.sd-item-time { flex: none; color: var(--faint); font-size: 11.5px; }
.sd-item-last { overflow: hidden; color: var(--muted); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }
.sd-item.unread .sd-item-last { color: var(--text); font-weight: 600; }
.sd-item .nav-badge { margin-left: 0; }
.sd-thread { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.sd-placeholder { margin: auto; }
.sd-thread-head { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sd-thread-who { display: grid; flex: 1; min-width: 180px; }
.sd-thread-who strong { font-size: 15px; }
.sd-thread-facts { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 12.5px; }
.sd-thread-facts strong { color: var(--text); }
.sd-composer textarea { min-height: 60px; }
.sd-send { height: 38px; }
@media (max-width: 1100px) {
  .sd-view { grid-template-columns: minmax(0, 1fr); height: auto; }
  .sd-threads { max-height: 36vh; }
  .sd-thread { height: 70vh; min-height: 420px; }
}

/* 访客统计 (console) */
.visit-toolbar { flex-wrap: wrap; gap: 10px 14px; }
.visit-days { display: flex; align-items: center; gap: 6px; }
.visit-days input { width: auto; padding: 5px 8px; font-size: 13px; }
.visit-online { margin-left: auto; font-size: 12.5px; }
.visit-chart-panel { margin-bottom: 20px; padding: 16px 18px 12px; }
.section-head.inline { margin: 0 0 8px; }
.visit-chart { display: block; width: 100%; height: 230px; }
.vc-bar { fill: color-mix(in srgb, var(--accent) 55%, transparent); }
.visit-chart g:hover .vc-bar { fill: var(--accent); }
.vc-line { fill: none; stroke: #f97316; stroke-width: 2; vector-effect: non-scaling-stroke; }
.vc-grid { stroke: var(--line); stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.vc-axis { fill: var(--muted); font-size: 11px; }
.vc-reg { fill: var(--ok); }
.vc-pay { fill: #e11d48; color: #e11d48; font-size: 12px; font-weight: 700; }
.vc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 6px; color: var(--text-2); font-size: 12px; }
.vc-legend span { display: inline-flex; align-items: center; gap: 6px; }
.vc-key { display: inline-block; width: 12px; height: 10px; border-radius: 2px; }
.vc-key.bar { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.vc-key.line { height: 2px; background: #f97316; }
.vc-key.reg { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); }
.visit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.visit-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.visit-card { padding: 14px 16px; margin-bottom: 16px; }
.visit-grid .visit-card { margin-bottom: 0; }
.visit-card h3 { margin: 0 0 8px; font-size: 14px; font-weight: 650; }
.visit-card table { width: 100%; }
.visit-card td, .visit-card th { padding: 6px 8px; }
.visit-card .vt-name { position: relative; max-width: 180px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.vt-bar { display: block; width: 100%; height: 3px; margin-top: 3px; }
.vt-bar rect { fill: color-mix(in srgb, var(--accent) 50%, transparent); }
.bot-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bot-chips b { margin-left: 4px; }
.visit-filter { gap: 10px; flex-wrap: wrap; justify-content: flex-start; }
.visit-filter input[type="search"] { width: 260px; }
.check-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }
.check-inline input { width: auto; }
.visit-table td { vertical-align: top; }
.nowrap { white-space: nowrap; }
@media (max-width: 1100px) { .visit-grid, .visit-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .visit-grid, .visit-grid.four { grid-template-columns: minmax(0, 1fr); } .visit-online { margin-left: 0; } }
.visit-card table { table-layout: fixed; min-width: 0; }
.visit-card th:not(:first-child), .visit-card td:not(:first-child) { width: 54px; text-align: right; }
.visit-card .vt-name { max-width: none; }
/* a breakdown's row opens its visits in 访问明细 */
.visit-card tr.vt-row { cursor: pointer; }
.visit-card tr.vt-row:hover td { background: var(--hover); }
.visit-card tr.vt-row.active td { background: var(--accent-soft); }
.visit-card tr.vt-row.active .vt-name { color: var(--accent-text); font-weight: 600; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; }
.filter-chip .link-button { font-size: 12px; line-height: 1; }
/* 推荐返佣 (console): six totals, the rules line, a withdrawal's payee with copy buttons, the referrer picked */
@media (min-width: 1101px) { .stats.rc-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1600px) { .stats.rc-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); } .rc-stats .stat-value { font-size: 24px; } }
.rc-rules > div { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; color: var(--text-2); font-size: 13px; }
.rc-wd-table td { vertical-align: top; }
.rc-payee-line { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.rc-payee-line > .muted { min-width: 38px; }
.rc-payee-line code { padding: 1px 6px; border-radius: 5px; background: var(--code-bg); color: var(--text); font-family: var(--mono); font-size: 12.5px; user-select: all; }
.dialog-form p.rc-confirm { margin: 6px 0 14px; color: var(--text); font-size: 15px; }
tr.rc-picked td { background: var(--accent-soft); }
.visit-note { margin: 8px 0 0; font-size: 12.5px; line-height: 1.7; }

/* 推荐返佣: the portal's page (invite code and link, wallet, its dialogs) and the code on the registration form */
.ref-invite { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 18px 28px; align-items: start; margin-bottom: 20px; padding: 22px 24px; }
.ref-share { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; min-width: 0; }
.ref-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.ref-code-row, .ref-link-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ref-code-row .button, .ref-link-row .button { flex: 0 0 auto; }
.ref-code { color: var(--accent-text); font: 800 30px/1.15 var(--mono); letter-spacing: .14em; }
.ref-link { flex: 1; min-width: 0; padding: 7px 10px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); font: 12.5px/1.5 var(--mono); white-space: nowrap; text-overflow: ellipsis; }
.ref-rules { margin: 0; padding: 12px 16px 12px 32px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text-2); font-size: 13px; line-height: 1.75; }
.ref-rules strong { color: var(--accent-text); }
.ref-paused, .ref-closed { margin: 0 0 20px; }
.ref-wallet { margin-bottom: 0; }
.ref-wallet .muted { overflow-wrap: anywhere; }
.ref-tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin: 24px 0 12px; }
.ref-tabs { flex-wrap: wrap; }
.ref-debit { font-weight: 600; font-variant-numeric: tabular-nums; }
td.ref-note { min-width: 160px; max-width: 360px; white-space: normal; overflow-wrap: anywhere; }
.ref-amount-row { display: flex; gap: 8px; }
.ref-amount-row input { flex: 1; min-width: 0; }
.ref-amount-row .button { flex: 0 0 auto; }
.ref-current { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); font-size: 13px; }
.ref-current > span { color: var(--muted); }
.ref-current > strong { flex: 1; min-width: 0; color: var(--text); font-weight: 600; overflow-wrap: anywhere; }
.ref-dialog .notice.ref-dialog-notice { margin: 12px 0 0; }
.field-hint { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.field-hint:empty { display: none; }
.invite-input { font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.invite-input::placeholder { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; letter-spacing: 0; text-transform: none; }
@media (max-width: 1100px) { .ref-invite { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) {
  .ref-invite { padding: 18px 16px; }
  .ref-code { font-size: 26px; }
  .ref-wallet .actions { width: 100%; }
  .ref-wallet .actions .button { flex: 1 1 auto; }
  .ref-tabs-row { align-items: stretch; flex-direction: column; }
  .ref-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  td.ref-note { min-width: 0; max-width: none; }
}

/* 用量流水 → 模型统计 (model-chart.js) */
.model-chart { margin-bottom: 20px; padding: 16px 18px; }
.mc-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.mc-toggle { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; flex: 1 1 auto; min-width: 0; padding: 2px 0; border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.mc-toggle h2 { margin: 0; font-size: 15px; }
.mc-caret { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transform: rotate(90deg); transition: transform .15s; }
.mc-count { font-size: 12.5px; }
.mc-summary { display: none; flex-wrap: wrap; gap: 6px; }
.mc-chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); font-family: var(--mono); font-size: 12px; }
.mc-chip i { width: 8px; height: 8px; border-radius: 2px; }
.mc-chip i.claude { background: #d97757; } .mc-chip i.gpt { background: #10a37f; } .mc-chip i.deepseek { background: #4d6bfe; } .mc-chip i.gemini { background: #f9ab00; } .mc-chip i.other { background: #8b5cf6; }
.mc-chip b { font-family: inherit; font-weight: 600; }
.mc-open-hint { display: none; margin-left: auto; color: var(--accent-text); font-size: 12.5px; font-weight: 600; }
.mc-hint { margin: 4px 0 10px 22px; font-size: 12.5px; }
.model-chart.collapsed { padding-top: 12px; padding-bottom: 12px; }
.model-chart.collapsed .mc-caret { transform: none; }
.model-chart.collapsed .mc-summary { display: inline-flex; }
.model-chart.collapsed .mc-open-hint { display: inline; }
.model-chart.collapsed .mc-head .seg, .model-chart.collapsed .mc-hint, .model-chart.collapsed .mc-rows, .model-chart.collapsed .mc-foot { display: none; }
.mc-rows { display: grid; gap: 4px; }
.mc-row { display: grid; grid-template-columns: minmax(120px, 230px) minmax(0, 1fr) 96px 52px; align-items: center; gap: 12px; width: 100%; padding: 5px 8px; border: 1px solid transparent; border-radius: 8px; background: none; color: var(--text); font: inherit; text-align: left; cursor: default; }
button.mc-row { cursor: pointer; }
button.mc-row:hover { background: var(--hover); }
.mc-row.active { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: var(--accent-soft); }
.mc-name { overflow: hidden; font-family: var(--mono); font-size: 12.5px; white-space: nowrap; text-overflow: ellipsis; }
.mc-track { display: block; width: 100%; height: 14px; border-radius: 4px; background: var(--surface-2); }
.mc-bar.claude { fill: #d97757; } .mc-legend i.claude { background: #d97757; }
.mc-bar.gpt { fill: #10a37f; } .mc-legend i.gpt { background: #10a37f; }
.mc-bar.deepseek { fill: #4d6bfe; } .mc-legend i.deepseek { background: #4d6bfe; }
.mc-bar.gemini { fill: #f9ab00; } .mc-legend i.gemini { background: #f9ab00; }
.mc-bar.other { fill: #8b5cf6; } .mc-legend i.other { background: #8b5cf6; }
.mc-value { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; text-align: right; }
.mc-share { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; text-align: right; }
.mc-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; }
.mc-legend { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.mc-legend i { display: inline-block; width: 10px; height: 10px; margin-left: 8px; border-radius: 3px; }
@media (max-width: 640px) { .mc-row { grid-template-columns: minmax(0, 1fr) 76px 44px; } .mc-track { grid-column: 1 / -1; grid-row: 2; } }

/* 模型价格: a model stopped (停用) */
.disabled-row td { color: var(--muted); background: var(--surface-2); }
.disabled-row td strong { color: var(--muted); text-decoration: line-through; }

/* 账号设置 */
.account-page { display: grid; gap: 18px; max-width: 720px; }
.account-page h2 { margin: 0 0 4px; font-size: 16px; }
.account-page > section > p { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.account-form { display: grid; gap: 12px; max-width: 420px; }

/* 权限管理: who is logged in, the login switch, roles' permissions, 操作日志, read-only notes */
.admin-who { margin-right: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.login-switch { margin: 10px 0 0; text-align: center; font-size: 13px; }
.perm-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.perm-chip { padding: 2px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12px; white-space: nowrap; }
.perm-chip.manage { border-color: transparent; background: var(--accent-soft); color: var(--accent-text); }
.perm-matrix { width: 100%; min-width: 0; margin-top: 6px; font-size: 13.5px; }
.perm-matrix td:first-child { width: 110px; font-weight: 600; white-space: nowrap; }
.perm-matrix td .check-inline { margin-right: 16px; }
.audit-table td { vertical-align: top; }
.audit-detail { max-width: 360px; overflow: hidden; color: var(--muted); font-family: var(--mono); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.read-only-note { margin: 10px 0 0; font-size: 12.5px; }
.sd-agent { margin: 0 2px 3px; color: var(--muted); font-size: 11.5px; text-align: right; }
.admin-panel { padding: 18px 20px; }
.admin-panel + .admin-panel { margin-top: 18px; }
.admin-panel .section-head.inline { align-items: flex-start; }

/* 推广链接 */
.ref-url { display: flex; align-items: center; gap: 8px; }
.ref-url code { font-family: var(--mono); font-size: 12.5px; white-space: nowrap; }
.rank-badge { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-weight: 700; font-size: 12px; color: #fff; background: var(--muted); }
.rank-badge.rank-1 { background: #d97706; }
.rank-badge.rank-2 { background: #64748b; }
.rank-badge.rank-3 { background: #b45309; }
.ref-tag { display: inline-block; margin-top: 2px; color: var(--accent-text); font-size: 12px; }
.ref-users { max-height: 56vh; overflow: auto; }
.ref-off td { color: var(--muted); }
.link-button.recheck { display: block; margin: 4px 0 2px; font-size: 12.5px; font-weight: 600; }
/* 上游管理 → OAuth 登录: the authorize link to copy */
.login-link { display: flex; gap: 8px; margin: 8px 0 4px; }
.login-link input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; }
.login-link .button { flex: 0 0 auto; }
/* 提示词拦截 */
.guard-panel { margin-top: 18px; }
.guard-settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.guard-test-grid { grid-template-columns: minmax(0, 1fr) 280px; }
@media (max-width: 760px) { .guard-settings-grid, .guard-test-grid { grid-template-columns: 1fr; } }
.guard-words { max-width: 300px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.guard-excerpt { max-width: 360px; font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--text-2); white-space: normal; word-break: break-all; }
.guard-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.guard-filter select { width: auto; min-width: 180px; max-width: 100%; }
.guard-filter .search-input { width: 280px; max-width: 100%; }
.guard-blocks .guard-excerpt { min-width: 240px; }
.guard-refusal-head { margin-top: 22px; }
.guard-refusal-head h3 { margin: 0 0 2px; font-size: 15px; }
.guard-refusals .guard-excerpt { min-width: 240px; }
.guard-probes .guard-excerpt { min-width: 160px; max-width: 280px; }
.guard-import { align-items: center; margin: 18px 0 4px; }
.guard-import .small-note { flex: 1 1 260px; max-width: none; white-space: normal; }
.guard-panel .settings-switch { align-items: flex-start; }
.guard-panel .settings-switch .switch { flex: 0 0 auto; margin-top: 2px; }
.guard-test-result { margin-top: 14px; }
.guard-mode { display: flex; gap: 18px; }
.guard-models { display: grid; gap: 12px; max-height: 360px; margin-top: 6px; padding: 12px 14px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.guard-client-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-top: 6px; }
.guard-client-item { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.guard-client-item input { margin-top: 3px; flex: 0 0 auto; }
.guard-client-item strong { display: block; font-size: 13px; }
.guard-client-item small { display: block; font-size: 11.5px; line-height: 1.4; margin-top: 2px; }
.conc-presets { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 4px; }
.conc-presets .small-note { margin-top: 0; }
.lang-check-list { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.lang-check { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; user-select: none; transition: border-color .12s, background .12s; }
.lang-check:hover { background: var(--surface-2); }
.lang-check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 500; }
.dialog-form .lang-hint { margin: 6px 0 0; font-size: 12.5px; line-height: 1.55; }
.lang-cell { min-width: 108px; max-width: 196px; white-space: normal; }
.lang-tags { gap: 4px; }
.lang-tag { font-size: 11.5px; padding: 1px 7px; }
/* 用户手册与合规条款 */
.manual-agree { margin-top: 12px; }
.manual-check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 400; line-height: 1.55; color: var(--text-2); }
.field .manual-check { font-weight: 400; }
.manual-check input[type="checkbox"] { flex: 0 0 auto; width: 16px; height: 16px; margin-top: 2px; cursor: pointer; }
.manual-open-btn { display: inline; padding: 0; font-size: inherit; font-weight: 550; vertical-align: baseline; }
.footer-manual-btn { margin-left: 12px; font-size: 12.5px; }
.action-dialog.manual-dialog { width: min(680px, calc(100vw - 28px)); }
.manual-updated { margin: 2px 0 8px; font-size: 12px; }
.manual-body { max-height: min(62vh, 520px); overflow-y: auto; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: 13.5px; line-height: 1.7; }
.manual-body > :first-child { margin-top: 0; }
.manual-body > :last-child { margin-bottom: 0; }
.manual-body h3 { margin: 16px 0 8px; font-size: 14.5px; font-weight: 650; color: var(--text); }
.manual-body h4 { margin: 12px 0 6px; font-size: 13.5px; font-weight: 650; color: var(--text); }
.manual-body p { margin: 8px 0; color: var(--text-2); }
.manual-body ul, .manual-body ol { margin: 6px 0 10px; padding-left: 20px; color: var(--text-2); }
.manual-body li { margin: 4px 0; }
.manual-body strong { color: var(--text); font-weight: 650; }
.manual-body code { padding: 1px 5px; border-radius: 4px; background: var(--code-bg); font-family: var(--mono); font-size: 12px; }
.guard-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.guard-group legend { margin-bottom: 6px; padding: 0; font-weight: 600; }
.guard-model-list { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-left: 22px; }
.guard-extra { margin-top: 4px; }
.guard-enabled { margin-top: 16px; }

/* ---------- Admin console on a phone (the drawer navigation and the card tables are the portal's, above) ---------- */
/* No text inflation: iOS enlarges some blocks' text on its own, which made paragraphs bigger than their headings. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.mobile-bar #mobileRefresh { width: 42px; height: 42px; color: var(--muted); }
.mobile-bar #mobileRefresh .icon { width: 20px; height: 20px; }
@media (max-width: 900px) {
  .admin-app .topbar { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 16px; }
  .admin-app .topbar p { font-size: 13px; }
  .admin-app .top-actions { justify-content: flex-start; gap: 6px; }
  .admin-app .top-actions #refresh { display: none; } /* in the bar at the top */
  .admin-app .notice { margin-top: 0; }
  .settings-tabs { display: flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .settings-tabs::-webkit-scrollbar { display: none; }
  .settings-tabs .seg-button { flex: 0 0 auto; }
}
@media (max-width: 640px) {
  .admin-app .main { padding-top: 14px; }
  .admin-app .form-panel { padding: 16px 14px; }
  .admin-app .toolbar { padding: 10px 12px; }
  .admin-app .section-head { flex-wrap: wrap; }
  /* a card's cell: its label at the left, the value (lines, tags, buttons) at the right */
  .admin-app table.cards tr { padding: 10px 12px; }
  .admin-app table.cards td { display: block; position: relative; min-height: 26px; padding: 4px 0 4px 34%; text-align: right; }
  .admin-app table.cards td::before { position: absolute; top: 5px; left: 0; width: 32%; max-width: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; text-align: left; }
  .admin-app table.cards td:not([data-label]) { padding-left: 0; text-align: left; }
  .admin-app table.cards td .small-note, .admin-app table.cards td .status-reason { max-width: 100%; margin-left: auto; white-space: normal; overflow-wrap: anywhere; }
  .admin-app table.cards td .row-actions, .admin-app table.cards td .tags, .admin-app table.cards td .link-row { justify-content: flex-end; flex-wrap: wrap; margin-top: 2px; }
  .admin-app table.cards td input:not([type="checkbox"]):not([type="radio"]), .admin-app table.cards td select { text-align: left; }
  .admin-app table.cards td .switch { margin-left: auto; }
  .admin-app table.cards .mono, .admin-app table.cards code { overflow-wrap: anywhere; }
  .admin-app .pager { justify-content: center; }
  .admin-app .page-footer { margin-top: 18px; }
}
/* 客服管理 on a phone: the list of conversations, or one conversation with a way back */
.sd-back { display: none; }
@media (max-width: 640px) {
  .sd-back { display: inline-flex; }
  .sd-view.has-thread .sd-threads, .sd-view:not(.has-thread) .sd-thread { display: none; }
  .sd-threads { max-height: none; }
  .sd-thread { height: calc(100dvh - 120px); min-height: 380px; }
  .sd-toolbar .actions { flex-wrap: wrap; }
  .sd-search { flex: 1 1 160px; width: auto; }
  .sd-thread-head { padding: 10px 12px; }
  .sd-thread-who { min-width: 0; }
  /* filters of a list: the search box takes the room left */
  .admin-app .filters { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
  .admin-app .filters .search-input, .admin-app .filters input[type="search"] { flex: 1 1 200px; width: auto !important; min-width: 0; }
  .admin-app .filters select { flex: 1 1 140px; width: auto; min-width: 0; }
  .upstream-toolbar .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .upstream-toolbar .filters .search-input { grid-column: 1 / -1; width: 100% !important; }
  .upstream-toolbar .filters select { width: 100%; }
}
/* a tall dialog on a phone scrolls under its buttons, which stay in reach */
@media (max-width: 640px) {
  .action-dialog .dialog-actions { position: sticky; bottom: 0; z-index: 1; padding-top: 12px; padding-bottom: 14px; border-top: 1px solid var(--line); background: var(--surface); }
}
@media (max-width: 640px) { .admin-app table.cards .guard-excerpt { min-width: 0; max-width: 100%; text-align: left; } }
/* 用量记录: the request id with its copy button */
.copy-cell { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
/* API 密钥: 停用 and 删除 side by side */
.key-actions { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 8px; vertical-align: middle; }
@media (max-width: 640px) { table.cards .key-actions { margin-left: 0; justify-content: flex-end; } }

/* ---------- Claude 账号管理 (custom-field ledger) ---------- */
.ca-toolbar { gap: 10px; }
.ca-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; flex: 1 1 320px; min-width: 0; }
.ca-search { width: 240px; max-width: 100%; flex: 1 1 200px; }
.ca-filter-select { width: auto; min-width: 120px; max-width: 210px; flex: 0 1 auto; }
.ca-toolbar-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.ca-table-wrap th { white-space: nowrap; }
.ca-table-wrap td { vertical-align: middle; }
.ca-cell-copy { display: inline-flex; align-items: center; gap: 6px; max-width: 280px; }
.ca-cell-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.ca-copy-btn { opacity: 0.72; flex: 0 0 auto; }
tr:hover .ca-copy-btn, .ca-copy-btn:focus-visible { opacity: 1; }
.ca-textarea-cell { min-width: 140px; max-width: 260px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; word-break: break-word; font-size: 13px; color: var(--text-2); }
.ca-upload-box .small-note, .ca-field-info .small-note { max-width: none; white-space: normal; overflow: visible; text-overflow: clip; }
@media (min-width: 641px) {
  .ca-table-wrap .ca-actions-col { position: sticky; right: 0; background: var(--surface); box-shadow: -1px 0 0 var(--line); white-space: nowrap; }
  .ca-table-wrap .ca-actions-col .actions { flex-wrap: nowrap; }
  .ca-table-wrap thead .ca-actions-col { background: var(--surface-2); }
  .ca-table-wrap tbody tr:hover .ca-actions-col { background: var(--hover); }
}
.ca-files { display: flex; flex-wrap: wrap; gap: 6px; max-width: 280px; }
.ca-file-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 180px;
  padding: 3px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-2); font-size: 12px; text-decoration: none;
  transition: border-color .15s, background .15s;
}
.ca-file-chip:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); text-decoration: none; }
.ca-file-chip img { width: 20px; height: 20px; object-fit: cover; border-radius: 4px; flex: 0 0 auto; }
.ca-file-chip .icon { width: 14px; height: 14px; color: var(--muted); }
.ca-file-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.action-dialog.ca-record-dialog, .action-dialog.ca-fields-dialog { width: min(760px, calc(100vw - 28px)); }
.action-dialog.ca-lightbox { width: min(860px, calc(100vw - 28px)); }
.ca-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.ca-form-grid .field { margin-top: 0; }
.ca-field-full { grid-column: 1 / -1; }
.ca-type-tag {
  display: inline-block; padding: 1px 6px; margin-left: 4px;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); font: 500 11px/1.4 var(--mono); vertical-align: middle;
}

.ca-upload-box {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); transition: border-color .15s, background .15s;
}
.ca-upload-box.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.ca-upload-list { display: grid; gap: 8px; margin-top: 8px; }
.ca-upload-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.ca-upload-thumb {
  width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 6px;
  overflow: hidden; background: var(--surface-2); flex: 0 0 auto;
}
.ca-upload-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ca-upload-icon {
  width: 40px; height: 40px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line);
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: 0 0 auto;
}
.ca-upload-meta { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.ca-upload-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }

.ca-fields-body { display: grid; gap: 18px; }
.ca-fields-list { display: grid; gap: 8px; max-height: 290px; overflow-y: auto; padding-right: 2px; }
.ca-field-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
}
.ca-field-row.is-editing { border-color: var(--accent); background: var(--accent-soft); }
.ca-field-order { display: inline-flex; gap: 4px; flex: 0 0 auto; }
.ca-field-info { flex: 1 1 auto; min-width: 0; display: grid; gap: 3px; }
.ca-field-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.ca-field-editor {
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.ca-field-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ca-field-editor-head h3 { font-size: 14px; font-weight: 600; }
.ca-field-checks { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 14px; }
.ca-field-checks .check-row { margin-top: 0; gap: 8px; }
.ca-field-editor .dialog-actions { padding: 14px 0 0; margin-top: 14px; border-top: 1px solid var(--line); }

.ca-lightbox-body { display: grid; gap: 14px; }
.ca-lightbox-body img { max-width: 100%; max-height: 70vh; margin: 0 auto; border-radius: var(--radius-sm); object-fit: contain; background: var(--surface-2); }
.ca-lightbox-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .ca-form-grid { grid-template-columns: 1fr; }
  .ca-filters { width: 100%; }
  .ca-search { width: 100%; flex: 1 1 100%; }
  .ca-filter-select { flex: 1 1 calc(50% - 4px); max-width: none; }
  .ca-toolbar-actions { width: 100%; justify-content: flex-end; }
  .admin-app table.cards .ca-cell-copy { max-width: 100%; justify-content: flex-end; }
  .admin-app table.cards .ca-cell-text { max-width: 160px; }
  .admin-app table.cards .ca-textarea-cell { min-width: 0; max-width: 100%; text-align: right; }
  .admin-app table.cards .ca-files { max-width: 100%; justify-content: flex-end; }
  .ca-field-row { flex-wrap: wrap; }
}

/* ---------- IP 管理 (proxy IP inventory) ---------- */
.action-dialog.pip-dialog { width: min(720px, calc(100vw - 28px)); }
.pip-paste-box {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.pip-paste-box input { flex: 1 1 auto; min-width: 0; font-family: var(--mono); font-size: 12.5px; }
.pip-paste-box button { flex: 0 0 auto; white-space: nowrap; }
.pip-radio-group { display: flex; flex-wrap: wrap; gap: 10px; }
.pip-radio-pill {
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 108px; padding: 8px 14px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); cursor: pointer; font-weight: 500;
  transition: border-color .15s, background .15s, color .15s;
}
.pip-radio-pill input[type="radio"] { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); }
.pip-radio-pill:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.pip-compound {
  display: grid; grid-template-columns: 120px minmax(0, 1fr) auto 110px;
  align-items: center; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface); overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.pip-compound:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.pip-compound select, .pip-compound input { border: 0; border-radius: 0; box-shadow: none !important; background-color: transparent; }
.pip-compound select { border-right: 1px solid var(--line); }
.pip-compound input#pipHost, .pip-compound input#pipPort { font-family: var(--mono); }
.pip-colon { padding: 0 6px; color: var(--muted); font-weight: 600; border-left: 1px solid var(--line); line-height: 36px; }
.pip-meta-grid { display: grid; grid-template-columns: 120px minmax(0, 1fr) 150px; gap: 12px; margin-top: 16px; }
.pip-meta-grid .field { margin-top: 0; }
.pip-test-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.pip-test-bar .small-note { max-width: none; white-space: normal; }
.pip-test-result { margin-top: 10px; }
.pip-test-ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.pip-proto-badges { display: inline-flex; align-items: center; gap: 4px; flex-wrap: nowrap; }
.pip-addr-line { margin-top: 4px; }
.pip-creds { display: grid; gap: 4px; }
.pip-cred-line { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.pip-refresh-row { margin-top: 4px; }
.tag.proxy-tag { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.action-dialog.pip-providers-dialog { width: min(740px, calc(100vw - 28px)); }
.pip-label-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pip-label-row .link-button { font-size: 12px; }
.pip-provider-link { display: inline-flex; align-items: center; gap: 2px; color: var(--accent-text); font-weight: 500; text-decoration: none; }
.pip-provider-link:hover { text-decoration: underline; }
.pip-ext { font-size: 11px; line-height: 1; opacity: 0.85; }
.pip-sub-line { max-width: none; white-space: normal; }

@media (max-width: 640px) {
  .pip-paste-box { flex-direction: column; align-items: stretch; }
  .pip-compound { grid-template-columns: 100px minmax(0, 1fr) auto 76px; }
  .pip-meta-grid { grid-template-columns: 1fr; }
  .admin-app table.cards .pip-proto-badges { justify-content: flex-end; }
  .admin-app table.cards .pip-addr-line { display: flex; justify-content: flex-end; }
  .admin-app table.cards .pip-creds { justify-items: end; }
  .admin-app table.cards .pip-refresh-row { text-align: right; }
}
