/* =============================================================================
   云iPad机房中心 控制台样式（V1 经典企业版，参考 Ant Design Pro）
   -----------------------------------------------------------------------------
   · 深色侧栏 + 面包屑顶栏 + 白色页头通栏 + 灰底白卡。
   · 深浅色：<html data-theme="dark"> 切换；所有颜色都走下面的变量，深色块只覆盖变量。
     选择由 app.js 写入 localStorage（ipadwx-theme），index.html <head> 首屏前读取。
   · 侧栏收起：<html data-sider="collapsed">。
   · 类名与 app.js 动态生成的结构一一对应，改类名前先在 app.js 里全局搜索。
   ============================================================================= */

:root {
  color-scheme: light;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "SFMono-Regular", monospace;

  --bg: #f0f2f5;
  --surface: #ffffff;
  --surface-2: #fafafa;
  --elevated: #ffffff;
  --border: #f0f0f0;
  --border-strong: #d9d9d9;
  --text: rgba(0, 0, 0, .88);
  --text-2: rgba(0, 0, 0, .65);
  --muted: rgba(0, 0, 0, .45);
  --disabled: rgba(0, 0, 0, .25);

  --primary: #1677ff;
  --primary-hover: #4096ff;
  --primary-active: #0958d9;
  --primary-soft: #e6f4ff;
  --primary-border: #91caff;
  --link: #1677ff;

  --success: #52c41a; --success-soft: #f6ffed; --success-border: #b7eb8f; --success-text: #389e0d;
  --warning: #faad14; --warning-soft: #fffbe6; --warning-border: #ffe58f; --warning-text: #d48806;
  --danger:  #ff4d4f; --danger-soft:  #fff2f0; --danger-border:  #ffccc7; --danger-text:  #cf1322;
  --neutral-soft: rgba(0, 0, 0, .04);
  --neutral-hover: rgba(0, 0, 0, .06);

  --sider-bg: #001529;
  --sider-border: transparent;
  --sider-text: rgba(255, 255, 255, .65);
  --header-shadow: 0 1px 4px rgba(0, 21, 41, .08);
  --table-head-bg: #fafafa;
  --input-bg: #ffffff;
  --backdrop: rgba(0, 0, 0, .45);
  --shadow-pop: 0 6px 16px rgba(0, 0, 0, .08), 0 3px 6px -4px rgba(0, 0, 0, .12), 0 9px 28px 8px rgba(0, 0, 0, .05);
  --code-bg: #0f172a;
  --code-bar: #1e293b;
  --code-text: #e2e8f0;
  --inline-code-bg: rgba(0, 0, 0, .05);

  --tone-blue: #1677ff;   --tone-blue-bg: #e6f4ff;
  --tone-green: #52c41a;  --tone-green-bg: #f6ffed;
  --tone-amber: #fa8c16;  --tone-amber-bg: #fff7e6;
  --tone-violet: #722ed1; --tone-violet-bg: #f9f0ff;

  --radius: 8px;
  --radius-sm: 6px;
  --control-h: 32px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #141414;
  --surface-2: #1d1d1d;
  --elevated: #1f1f1f;
  --border: #303030;
  --border-strong: #424242;
  --text: rgba(255, 255, 255, .85);
  --text-2: rgba(255, 255, 255, .65);
  --muted: rgba(255, 255, 255, .45);
  --disabled: rgba(255, 255, 255, .25);

  --primary: #1668dc;
  --primary-hover: #3c89e8;
  --primary-active: #1554ad;
  --primary-soft: #111a2c;
  --primary-border: #15325b;
  --link: #3c89e8;

  --success: #49aa19; --success-soft: #162312; --success-border: #274916; --success-text: #6abe39;
  --warning: #d89614; --warning-soft: #2b2111; --warning-border: #594214; --warning-text: #e8b339;
  --danger:  #dc4446; --danger-soft:  #2c1618; --danger-border:  #58181c; --danger-text:  #e86e6b;
  --neutral-soft: rgba(255, 255, 255, .06);
  --neutral-hover: rgba(255, 255, 255, .1);

  --sider-bg: #141414;
  --sider-border: #303030;
  --header-shadow: 0 1px 0 #303030;
  --table-head-bg: #1d1d1d;
  --input-bg: transparent;
  --backdrop: rgba(0, 0, 0, .65);
  --shadow-pop: 0 6px 16px rgba(0, 0, 0, .5), 0 9px 28px 8px rgba(0, 0, 0, .35);
  --code-bg: #0a0a0a;
  --code-bar: #1d1d1d;
  --inline-code-bg: rgba(255, 255, 255, .08);

  --tone-blue: #3c89e8;   --tone-blue-bg: #111a2c;
  --tone-green: #6abe39;  --tone-green-bg: #162312;
  --tone-amber: #e89a3c;  --tone-amber-bg: #2b1d11;
  --tone-violet: #9e7bff; --tone-violet-bg: #1a1325;
}

/* ---------------------------------------------------------------- 基础 */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { min-width: 320px; background: var(--bg); color: var(--text); font: 14px/1.5715 var(--font); -webkit-font-smoothing: antialiased; transition: background-color .2s, color .2s; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--primary-hover); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary-hover); outline-offset: 2px; }
.skip-link { position: fixed; top: -80px; left: 8px; z-index: 100; padding: 8px 14px; border-radius: 6px; background: var(--surface); color: var(--text); }
.skip-link:focus { top: 8px; box-shadow: var(--shadow-pop); }
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.login-copy { color: var(--text-2); line-height: 1.7; }
.field-hint { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.form-error { min-height: 0; margin: 0; color: var(--danger-text); font-size: 13px; }
code { padding: 1px 5px; border-radius: 4px; background: var(--inline-code-bg); font-family: var(--mono); font-size: .9em; }
.eyebrow { display: none; }

/* ---------------------------------------------------------------- 按钮 */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--control-h); padding: 0 15px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: 14px; font-weight: 400; white-space: nowrap; transition: color .2s, background-color .2s, border-color .2s; }
.button.primary { background: var(--primary); color: #fff; box-shadow: 0 2px 0 rgba(5, 145, 255, .1); }
.button.primary:hover { background: var(--primary-hover); }
.button.primary:active { background: var(--primary-active); }
.button.secondary { border-color: var(--border-strong); background: var(--input-bg); color: var(--text); }
.button.secondary:hover { border-color: var(--primary-hover); color: var(--primary-hover); }
.button.danger { border-color: var(--danger); background: transparent; color: var(--danger); }
.button.danger:hover { background: var(--danger-soft); }
.button.small { height: 24px; padding: 0 8px; font-size: 13px; }
.button.large { height: 40px; font-size: 15px; }
.button.block { width: 100%; }
.button:disabled, .button[disabled] { cursor: not-allowed; opacity: .45; }
.text-button, .link-button { padding: 0; border: 0; background: none; color: var(--link); font-size: inherit; }
.text-button:hover, .link-button:hover { color: var(--primary-hover); }
.link-button { font-size: 14px; }
.icon-only { display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-2); }
.icon-only:hover { background: var(--neutral-hover); color: var(--text); }
.theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: none; }
body[aria-busy="true"] button, body[aria-busy="true"] .button { pointer-events: none; }
body[aria-busy="true"] .button { opacity: .72; }

/* ---------------------------------------------------------------- 表单 */
label { display: grid; gap: 6px; color: var(--text); font-size: 14px; }
input, select, textarea { width: 100%; min-height: var(--control-h); padding: 4px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--text); outline: none; transition: border-color .2s, box-shadow .2s; }
select option { background: var(--elevated); color: var(--text); }
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--disabled); }
input:hover, select:hover, textarea:hover { border-color: var(--primary-hover); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
input[readonly] { background: var(--surface-2); }
input[type="checkbox"], input[type="radio"] { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; accent-color: var(--primary); flex: none; cursor: pointer; }
.check-row { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.check-row.is-locked { cursor: not-allowed; opacity: .55; }
.check-row.is-locked em { font-size: 11px; font-style: normal; }
.check-line { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.form-stack, .form-grid { display: grid; gap: 16px; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.form-grid.one-column { grid-template-columns: minmax(0, 1fr); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.capability-fieldset { display: grid; gap: 10px; margin: 0; padding: 12px 16px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.capability-fieldset legend { padding: 0 6px; color: var(--muted); font-size: 13px; }
.input-affix { position: relative; display: block; }
.input-affix > .ic { position: absolute; top: 50%; left: 12px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.input-affix > input { height: 40px; padding-left: 36px; }

/* ---------------------------------------------------------------- 提示 */
.message { padding: 9px 14px; border: 1px solid var(--success-border); border-radius: var(--radius); background: var(--success-soft); color: var(--text); line-height: 1.6; }
.message.error { border-color: var(--danger-border); background: var(--danger-soft); }
.message .button { margin-left: 12px; }
/* 全局提示浮在顶部中间，不推挤页面内容；在弹窗打开时 app.js 会把它挪进弹窗里（top layer） */
#global-message { position: fixed; top: 68px; left: 50%; z-index: 80; width: max-content; max-width: min(640px, calc(100% - 32px)); transform: translateX(-50%); box-shadow: var(--shadow-pop); background-color: var(--elevated); border-left-width: 4px; }
#global-message:not(.error) { border-left-color: var(--success); }
#global-message.error { border-left-color: var(--danger); }
dialog #global-message { position: static; width: auto; max-width: none; margin: 12px 20px 0; transform: none; box-shadow: none; }
.security-warning { padding: 10px 14px; border: 1px solid var(--warning-border); border-radius: var(--radius); background: var(--warning-soft); color: var(--text); font-size: 13px; line-height: 1.65; }
.quote-box { padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text); line-height: 1.75; }
.quote-box:empty { display: none; }
.order-payment-note { color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.order-payment-note strong { color: var(--text-2); }
.help-details { margin-top: 12px; }
.help-details summary { color: var(--link); cursor: pointer; font-size: 13px; }
.help-details p { margin-top: 8px; font-size: 13px; }

/* ---------------------------------------------------------------- 标签 / 状态 */
/* 普通标签（能力名、读写类型）：Ant Tag */
.badge { display: inline-flex; align-items: center; gap: 6px; width: max-content; height: 22px; padding: 0 7px; border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface-2); color: var(--text-2); font-size: 12px; line-height: 20px; white-space: nowrap; }
/* 状态标签：Ant Badge status —— 圆点 + 文字 */
.badge.good, .badge.warn, .badge.bad { gap: 8px; padding: 0; border: 0; background: none; color: var(--text); font-size: 14px; }
.badge.good::before, .badge.warn::before, .badge.bad::before { content: ""; width: 6px; height: 6px; border-radius: 50%; flex: none; }
.badge.good::before { background: var(--success); }
.badge.warn::before { background: var(--warning); }
.badge.bad::before { background: var(--danger); }
td .badge + .badge { margin-left: 6px; }

/* ---------------------------------------------------------------- 登录（简约） */
.login-shell { position: relative; display: flex; flex-direction: column; min-height: 100vh; background: var(--bg); }
.login-theme { position: absolute; top: 16px; right: 16px; }
.login-panel { width: min(340px, calc(100% - 32px)); margin: auto; padding: 48px 0 32px; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 32px; color: var(--text); font-size: 20px; font-weight: 600; }
.login-brand .brand-mark { width: 36px; height: 36px; font-size: 14px; }
#login-title { margin-bottom: 4px; font-size: 18px; font-weight: 600; text-align: center; }
#login-copy { margin-bottom: 20px; color: var(--muted); font-size: 13px; text-align: center; }
.login-shell .form-stack { gap: 16px; }
.login-shell .form-error:empty { display: none; }
.demo-note { margin-top: 24px; color: var(--muted); font-size: 13.5px; text-align: center; }
.demo-note .text-button { font-size: 13.5px; }
.foot-sep { margin: 0 10px; color: var(--disabled); }
.login-copyright { padding: 0 16px 24px; color: var(--muted); font-size: 12.5px; text-align: center; }

/* ---------------------------------------------------------------- 品牌 */
.brand-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: #fff; font: 700 13px/1 var(--mono); flex: none; }
.brand-mark.small { width: 32px; height: 32px; }
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand-row strong, .brand-row span { display: block; }
.brand-row span { color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------- 外壳 */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { position: sticky; top: 0; z-index: 40; display: flex; flex-direction: column; width: 208px; height: 100vh; flex: none; background: var(--sider-bg); border-right: 1px solid var(--sider-border); color: var(--sider-text); transition: width .2s, background-color .2s; }
.sidebar .brand-row { height: 64px; padding: 0 20px; overflow: hidden; }
.brand-name { color: #fff; font-size: 16px; font-weight: 600; white-space: nowrap; }
#main-nav { flex: 1; display: grid; align-content: start; gap: 4px; padding: 4px 8px; overflow-y: auto; }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 16px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--sider-text); font-size: 14px; text-align: left; white-space: nowrap; overflow: hidden; transition: color .2s, background-color .2s; }
.nav-item:hover { color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.sider-collapse { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 24px; border: 0; border-top: 1px solid rgba(255, 255, 255, .08); background: none; color: rgba(255, 255, 255, .55); white-space: nowrap; overflow: hidden; }
.sider-collapse:hover { color: #fff; }
:root[data-sider="collapsed"] .sidebar { width: 64px; }
:root[data-sider="collapsed"] .sidebar .nav-label,
:root[data-sider="collapsed"] .sidebar .brand-name,
:root[data-sider="collapsed"] .onboarding-progress { display: none !important; }
:root[data-sider="collapsed"] .nav-item { justify-content: center; padding: 0; }
:root[data-sider="collapsed"] .sidebar .brand-row { padding: 0 16px; }
:root[data-sider="collapsed"] .sider-collapse { padding: 0 24px; }
.sidebar-mask { display: none; }

/* 侧栏顶部接入进度（开发者未完成接入时） */
.onboarding-progress { display: grid; gap: 6px; margin: 0 16px 12px; padding: 10px 12px; border-radius: var(--radius); background: rgba(255, 255, 255, .06); color: rgba(255, 255, 255, .85); }
.onboarding-progress .login-copy { color: rgba(255, 255, 255, .55); font-size: 12px; line-height: 1.4; }
.onboarding-progress strong { font-size: 13px; font-weight: 500; }
.onboarding-progress .progress { height: 4px; background: rgba(255, 255, 255, .15); }
.onboarding-progress .text-button { justify-self: start; color: #69b1ff; font-size: 12.5px; }

.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 4px; height: 56px; padding: 0 16px 0 24px; background: var(--surface); box-shadow: var(--header-shadow); transition: background-color .2s; }
.menu-button { display: none; }
.request-status { margin-left: 12px; color: var(--muted); font-size: 12.5px; }
.session-expiry { display: inline-flex; align-items: center; height: 24px; margin-right: 8px; padding: 0 10px; border-radius: 12px; background: var(--primary-soft); color: var(--link); font-size: 12.5px; white-space: nowrap; }
.session-expiry.warn { background: var(--warning-soft); color: var(--warning-text); }
.health-pill { display: inline-flex; align-items: center; gap: 6px; margin-right: 8px; color: var(--text-2); font-size: 13px; white-space: nowrap; }
.health-pill span { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.health-pill.bad { color: var(--danger-text); }
.health-pill.bad span { background: var(--danger); }
.health-pill em { font-style: normal; }
#global-refresh.is-spinning .ic { animation: refresh-spin .6s linear infinite; }
@keyframes refresh-spin { to { transform: rotate(360deg); } }

/* 右上角用户菜单 */
.user-menu { position: relative; margin-left: 8px; }
.user-menu summary { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px; border-radius: var(--radius-sm); list-style: none; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary:hover { background: var(--neutral-hover); }
.user-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; }
.user-avatar .ic { width: 15px; height: 15px; }
.user-text { display: grid; line-height: 1.25; }
#session-user { color: var(--text); font-size: 13.5px; }
.role-chip { color: var(--muted); font-size: 12px; }
.user-menu .caret { width: 14px; height: 14px; color: var(--muted); transition: transform .15s; }
.user-menu[open] .caret { transform: rotate(180deg); }
.user-menu-body { position: absolute; top: calc(100% + 4px); right: 0; z-index: 60; display: grid; min-width: 160px; padding: 4px; border-radius: var(--radius); background: var(--elevated); box-shadow: var(--shadow-pop); }
.user-menu-body button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 12px; border: 0; border-radius: 4px; background: none; color: var(--text); text-align: left; white-space: nowrap; }
.user-menu-body button:hover { background: var(--neutral-hover); }
.user-menu-body button.danger { color: var(--danger-text); }

main { flex: 1; padding: 0 24px 24px; }
main:focus { outline: none; }
.page { display: none; }
.page.active { display: block; animation: reveal .2s ease both; }
.page > * + * { margin-top: 16px; }
.page > .page-head + * { margin-top: 24px; }
@keyframes reveal { from { opacity: 0; } to { opacity: 1; } }

/* 页头：Ant Pro PageContainer 通栏 */
.page-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 16px; margin: 0 -24px; padding: 16px 24px 20px; background: var(--surface); border-bottom: 1px solid var(--border); transition: background-color .2s; }
.page-head h1 { font-size: 20px; font-weight: 600; line-height: 1.4; }
.page-head p { max-width: 880px; margin-top: 4px; color: var(--muted); font-size: 14px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; margin-bottom: 4px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 13px; }
.back-link:hover { color: var(--link); }
/* 接口文档页原来没有页头，靠顶部留白；加了带「在线测试」的页头后与其他页一致，贴着顶栏，不再额外留白。 */
#page-docs { padding-top: 0; }

/* ---------------------------------------------------------------- 卡片与栅格 */
.panel { min-width: 0; padding: 20px 24px; border-radius: var(--radius); background: var(--surface); transition: background-color .2s; }
.panel.flush { padding: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.panel-head > div { min-width: 0; }
.panel-head h3 { font-size: 16px; font-weight: 600; }
.panel-head p { margin-top: 2px; color: var(--muted); font-size: 13px; }
.panel.flush > .panel-head { min-height: 56px; margin: 0; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.content-grid { display: grid; gap: 16px; align-items: start; }
.content-grid.main-side { grid-template-columns: minmax(0, 1fr) 340px; }
.content-grid.side-main { grid-template-columns: 360px minmax(0, 1fr); }
/* 侧栏面板是 .admin-only 时，开发者看到的是被 hidden 的空列——主面板只占左半边，右边空一大块。
   两栏里只要有一栏被隐藏，就退回单栏，让剩下的那个面板占满整行。 */
.content-grid.main-side:has(> [hidden]), .content-grid.side-main:has(> [hidden]) { grid-template-columns: minmax(0, 1fr); }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 32px; align-items: start; }

/* 统计卡 */
/* 管理员 4 张、开发者 5 张卡：用 auto-fit 让两种数量都能铺满整行，不用为谁单独写一套。 */
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.metric { display: flex; align-items: flex-start; gap: 12px; min-width: 0; padding: 20px 24px; border-radius: var(--radius); background: var(--surface); transition: background-color .2s; }
.metric-main { flex: 1; min-width: 0; }
.metric-label, .metric > span:first-child, .metric > p:first-child { color: var(--muted); font-size: 14px; }
.metric strong { display: block; margin: 4px 0 2px; color: var(--text); font-size: 30px; font-weight: 500; line-height: 1.3; font-variant-numeric: tabular-nums; }
.metric strong small { color: var(--muted); font-size: 16px; font-weight: 400; }
.metric small { display: block; color: var(--muted); font-size: 13px; }
.metric strong small { display: inline; color: var(--muted); font-size: 16px; font-weight: 400; }
.metric small.warn { color: var(--warning-text); }
.metric-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; flex: none; }
.metric-icon .ic { width: 20px; height: 20px; }
.tone-blue { color: var(--tone-blue); background: var(--tone-blue-bg); }
.tone-green { color: var(--tone-green); background: var(--tone-green-bg); }
.tone-amber { color: var(--tone-amber); background: var(--tone-amber-bg); }
.tone-violet { color: var(--tone-violet); background: var(--tone-violet-bg); }
.metrics.inner .metric { padding: 16px 20px; border: 1px solid var(--border); }
.metrics.inner .metric strong { font-size: 26px; }

/* ---------------------------------------------------------------- 工具条 / 分段筛选 / 搜索 */
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 16px; padding: 16px 24px; border-bottom: 1px solid var(--border); }
.seg { display: inline-flex; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg:empty { display: none; }
.seg-item { display: inline-flex; align-items: center; gap: 6px; height: 32px; margin-left: -1px; padding: 0 14px; border: 1px solid var(--border-strong); background: var(--input-bg); color: var(--text); font-size: 14px; white-space: nowrap; }
.seg-item:first-child { margin-left: 0; border-radius: 6px 0 0 6px; }
.seg-item:last-child { border-radius: 0 6px 6px 0; }
.seg-item:hover { color: var(--primary-hover); }
.seg-item.active { position: relative; z-index: 1; border-color: var(--primary); color: var(--link); }
.seg-count { color: inherit; font-size: 12px; opacity: .65; }
.search { position: relative; display: block; width: 240px; }
.search > .ic { position: absolute; top: 50%; left: 10px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search > input { padding-left: 32px; }
.guide { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; padding: 12px 24px; border-bottom: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 13px; }
.guide b { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 6px; border-radius: 50%; background: var(--primary-soft); color: var(--link); font-size: 12px; }
.guide-sep { color: var(--disabled); }

/* ---------------------------------------------------------------- 表格 */
.table-wrap { width: 100%; overflow-x: auto; }
.panel:not(.flush) .table-wrap, .docs-body .table-wrap { border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--table-head-bg); color: var(--text); font-size: 14px; font-weight: 600; text-align: left; white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--border); line-height: 1.5; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-2); }
.data-table td { white-space: nowrap; }
td strong, td span { display: block; }
td span { color: var(--muted); font-size: 13px; }
td strong { font-weight: 500; }
.events-table td:last-child { min-width: 280px; white-space: normal; }
.cell-error { max-width: 240px; overflow: hidden; color: var(--danger-text) !important; text-overflow: ellipsis; white-space: nowrap; }
.row-note { color: var(--muted); font-size: 12px; }
.col-check { width: 44px; padding-right: 0; }
.empty { padding: 32px 16px; color: var(--muted); text-align: center; white-space: normal !important; }
.empty .button { margin-left: 8px; }
.row-editable { cursor: pointer; }
.profile-cell { display: flex; align-items: center; gap: 8px; }
.profile-cell > div > span { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; margin-right: 8px; border-radius: 50%; background: var(--neutral-soft); color: var(--muted); font-size: 11px; object-fit: cover; vertical-align: middle; }
.qr-thumb { width: 36px; height: 36px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 4px; background: #fff; cursor: pointer; object-fit: contain; vertical-align: middle; }
.qr-thumb:hover { border-color: var(--primary); }
.date-cell { white-space: nowrap; }

/* 表格里的操作：文字链接样式（Ant 表格惯例），主操作一个 + 「更多」下拉 */
.actions { display: flex; align-items: center; flex-wrap: nowrap; gap: 12px; }
.data-table td:not(.empty) .button.small { height: auto; padding: 0; border: 0; background: none; box-shadow: none; color: var(--link); font-size: 14px; }
.data-table td:not(.empty) .button.small:hover { color: var(--primary-hover); }
.data-table td:not(.empty) .button.danger.small { color: var(--danger-text); }
.icon-button { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-left: 4px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: var(--muted); vertical-align: middle; }
.icon-button:hover { background: var(--neutral-hover); color: var(--link); }
.icon-button .ic { width: 14px; height: 14px; }
.dot-button { display: inline-grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 4px; background: transparent; }
.dot-button:hover { background: var(--neutral-hover); }
.dot-button .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); }
.dot-button.good .dot { background: var(--success); }

.row-more { position: static; display: inline-block; }
.row-more > summary { display: inline-flex; align-items: center; gap: 2px; color: var(--link); cursor: pointer; list-style: none; user-select: none; }
.row-more > summary::-webkit-details-marker { display: none; }
.row-more > summary .ic { width: 14px; height: 14px; }
.row-more .menu { position: fixed; top: 0; left: 0; z-index: 70; display: grid; min-width: 168px; padding: 4px; border-radius: var(--radius); background: var(--elevated); box-shadow: var(--shadow-pop); }
.row-more .menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 12px; border: 0; border-radius: 4px; background: none; color: var(--text); font-size: 14px; text-align: left; white-space: nowrap; }
.row-more .menu button:hover { background: var(--neutral-hover); }
.row-more .menu button.danger { color: var(--danger-text); }

/* 容量与进度 */
.capacity-list { display: grid; gap: 16px; }
.capacity-label { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: 13px; }
.capacity-label span { color: var(--muted); }
.progress { height: 6px; overflow: hidden; border-radius: 3px; background: var(--neutral-hover); }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.shard-details { margin-top: 6px; }
.shard-details summary { color: var(--link); cursor: pointer; font-size: 13px; }
.shard-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; margin-top: 6px; padding: 6px 10px; border-radius: 4px; background: var(--surface-2); font-size: 12.5px; }
.shard-row span:not(.badge) { display: inline; color: var(--muted); }

/* ---------------------------------------------------------------- 快速开始 */
.stepper { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.step { display: grid; align-content: start; gap: 4px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.step .n { color: var(--muted); font-size: 12.5px; }
.step strong { font-size: 14px; font-weight: 500; }
.step small { color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.step.done { border-color: var(--success-border); background: var(--success-soft); }
.step.done .n { color: var(--success-text); }
.step.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.step.active .n { color: var(--link); }
#quickstart-body { display: grid; gap: 16px; }
#quickstart-body .panel > .login-copy + .login-copy { margin-top: 8px; }
#quickstart-alert:not(:empty) { display: grid; gap: 8px; margin-bottom: 16px; }

/* ---------------------------------------------------------------- 平台设置 */
#settings-form { display: grid; gap: 16px; margin-top: 16px; }
.settings-top { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
.settings-wide { grid-column: 1 / -1; }
.settings-actions { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 24px; border-radius: var(--radius); background: var(--surface); box-shadow: 0 -2px 8px rgba(0, 0, 0, .06); }
.settings-actions .login-copy { font-size: 13px; }

/* ---------------------------------------------------------------- 弹窗与抽屉 */
dialog { width: min(520px, calc(100% - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: var(--radius); background: var(--elevated); color: var(--text); box-shadow: var(--shadow-pop); }
dialog::backdrop { background: var(--backdrop); }
.dialog-card { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.dialog-head, .drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 16px 20px 12px 24px; border-bottom: 1px solid var(--border); }
.dialog-head h3, .drawer-head h3 { font-size: 16px; font-weight: 600; line-height: 32px; }
.dialog-head .login-copy { font-size: 13px; }
.dialog-body, .drawer-body { display: grid; align-content: start; gap: 14px; padding: 20px 24px; overflow-y: auto; }
.dialog-body > p:not([class]) { color: var(--text-2); }
.dialog-actions, .drawer-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 24px; border-top: 1px solid var(--border); }
#action-form .dialog-body #dialog-description:empty { display: none; }
.dialog-card.wide, #agent-dialog { width: min(720px, calc(100% - 32px)); }

dialog.drawer { width: min(480px, 100%); height: 100vh; max-height: 100vh; margin: 0 0 0 auto; border-radius: 0; animation: drawer-in .22s ease; }
.drawer-card { display: flex; flex-direction: column; height: 100%; }
.drawer-body { flex: 1; }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } }

.pairing-qr { display: block; width: min(300px, 100%); height: auto; margin: 4px auto; border: 12px solid #fff; border-radius: var(--radius); background: #fff; }
.pairing-payload { min-height: 96px; overflow-wrap: anywhere; }
/* 二维码窗口比通用对话框窄。宽度必须设在 <dialog> 上——只改内部卡片的话
   dialog 仍是 520px，右侧会空出 120px，关闭按钮看着就不在右上角（2026-09-23 现场反馈）。 */
#qr-dialog { width: min(400px, calc(100% - 32px)); }
.qr-card { width: 100%; }
.qr-stage { display: grid; place-items: center; min-height: 280px; }
.qr-image { display: block; width: min(280px, 100%); height: auto; border: 12px solid #fff; border-radius: var(--radius); background: #fff; }
.qr-placeholder { display: grid; place-items: center; width: 280px; max-width: 100%; height: 280px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); font-size: 13px; }
.qr-status { min-height: 22px; color: var(--muted); font-size: 13.5px; text-align: center; }
.qr-status.ok { color: var(--success-text); font-weight: 500; }
.qr-status.bad { color: var(--danger-text); }

/* 表格单元格里的第二行小字（例如出口 IP 挂在归属地/出口名下面），不撑高行距。 */
.cell-sub { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }

/* 已扫码身份：一行头像加名字，放在二维码与状态行之间，告诉操作员码确实扫上了。 */
.qr-scanned { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; }
.qr-scanned-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.qr-scanned-text { text-align: left; font-size: 13.5px; line-height: 1.35; }
.qr-scanned-text span { display: block; color: var(--muted); font-size: 12.5px; }

/* 新设备验证：整块按警示色描边，让人一眼看出此刻该做的不是换码而是打开链接。 */
.qr-verification { margin-top: 14px; padding: 14px; border: 1px solid var(--danger-text); border-radius: 10px; text-align: left; }
.qr-verification h4 { margin: 0 0 6px; font-size: 14.5px; color: var(--danger-text); }
.qr-verification p { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
/* 扫码入口放在链接之前：这是目前唯一能通过微信环境校验的打开方式。 */

/* 链接本身很长，必须允许断行，否则会把对话框撑宽 */
.qr-verification-link { display: block; margin-bottom: 10px; font-size: 12.5px; word-break: break-all; }
.qr-verification-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.qr-verification-countdown { font-size: 12.5px; color: var(--muted); }

.uptime-tabs { display: inline-flex; }
.link-tab { height: 30px; margin-left: -1px; padding: 0 14px; border: 1px solid var(--border-strong); background: var(--input-bg); color: var(--text); font-size: 13px; }
.link-tab:first-child { margin-left: 0; border-radius: 6px 0 0 6px; }
.link-tab:last-child { border-radius: 0 6px 6px 0; }
.link-tab.is-active { position: relative; z-index: 1; border-color: var(--primary); color: var(--link); }
.uptime-chart { min-height: 80px; }
.uptime-svg { display: block; width: 100%; height: 80px; margin-top: 8px; }
.uptime-line { stroke: var(--primary); stroke-width: 1.5; }
.dot { stroke: none; }
.dot.up { fill: var(--success); }
.dot.partial { fill: var(--warning); }
.dot.down { fill: var(--danger); }
.dot.gap { fill: var(--disabled); }

/* 在线测试面板 */
#playground-dialog { width: min(1000px, calc(100% - 32px)); }
.playground-body { gap: 16px; }
.playground-key { display: grid; gap: 8px; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.playground-key p { font-size: 13px; }
.playground-request .code-block pre { max-height: 200px; overflow: auto; }
.playground-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
.playground-grid > div { min-width: 0; }
.playground-grid .code-block pre { max-height: 240px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
.playground-grid p { margin: 0 0 8px; }
.playground-grid .security-warning { margin: 8px 0; }
.playground-slot-empty { padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: var(--radius); color: var(--muted); font-size: 13px; }

/* ---------------------------------------------------------------- 接口文档（结构不变，配色跟随主题） */
.docs-shell { min-height: 100vh; background: var(--bg); }
.docs-topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 56px; padding: 0 clamp(16px, 4vw, 40px); background: var(--surface); box-shadow: var(--header-shadow); }
.docs-topbar .brand-row strong { color: var(--text); }
.docs-topbar-actions { display: flex; align-items: center; gap: 8px; }
.docs-shell .docs-layout { padding: clamp(16px, 3vw, 32px); }
.docs-layout { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: 24px; align-items: start; }
.docs-toc { position: sticky; top: 80px; display: grid; gap: 2px; max-height: calc(100vh - 104px); overflow-y: auto; padding: 8px; border-radius: var(--radius); background: var(--surface); font-size: 13.5px; }
.docs-toc a { display: block; padding: 6px 12px; border-radius: var(--radius-sm); color: var(--text-2); }
.docs-toc a:hover { background: var(--neutral-hover); color: var(--text); }
.docs-toc a.active { background: var(--primary-soft); color: var(--link); }
.docs-toc .doc-toc-sub { padding-left: 24px; font-size: 12.5px; }
/* 目录里的可折叠分组（开放能力 / 协议全集各模块），同一时间只展开一组 */
.doc-toc-group > summary { display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 20px; border-radius: var(--radius-sm); color: var(--text-2); cursor: pointer; list-style: none; font-size: 13px; }
.doc-toc-group > summary::-webkit-details-marker { display: none; }
.doc-toc-group > summary::before { content: "▸"; color: var(--muted); font-size: 11px; }
.doc-toc-group[open] > summary::before { content: "▾"; }
.doc-toc-group > summary:hover { background: var(--neutral-hover); color: var(--text); }
.doc-toc-group > summary em { margin-left: auto; color: var(--muted); font-style: normal; font-size: 12px; }
.doc-toc-group[open] > summary { color: var(--link); }
.doc-toc-group .doc-toc-sub { padding-left: 36px; }
/* 目录两层折叠：章节（接口能力目录）→ 分组 → 链接 */
.doc-toc-section > summary { padding-left: 12px; font-size: 13.5px; }
.doc-toc-section.active > summary { background: var(--primary-soft); color: var(--link); }
.doc-toc-subgroup > summary { padding-left: 24px; }
.doc-toc-subgroup .doc-toc-sub { padding-left: 44px; }
.docs-toc .doc-toc-pending { color: var(--muted); }
.docs-toc .doc-toc-pending::after { content: " · 未接入"; font-size: 11px; }
.doc-cap-group { padding-top: 8px; border-top: 1px solid var(--border); }
.doc-proto-path { font-size: 12.5px; }
/* 生成密钥抽屉：能力按分组勾选，每组一个全选 */
.capability-check-group { display: grid; gap: 4px; }
.capability-check-all { font-weight: 600; }
.capability-check-items { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 12px; padding-left: 22px; }
/* 正文里的协议接口：默认折叠，一行一条 */
.doc-api-group + .doc-api-group { margin-top: 8px; }
.doc-api-group .doc-h4 .muted { font-size: 12.5px; font-weight: 400; }
.doc-api { border: 1px solid var(--border); border-radius: var(--radius-sm); margin-top: 6px; scroll-margin-top: 80px; }
.doc-api > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 9px 12px; cursor: pointer; list-style: none; }
.doc-api > summary::-webkit-details-marker { display: none; }
/* 接口标题单独着色，与路径、徽标区分开；展开的那一条再加粗并用左色条标出（同一时间只展开一条） */
.doc-api > summary strong { min-width: 150px; font-weight: 500; color: var(--primary); }
.doc-api > summary:hover strong { color: var(--primary-hover); }
.doc-api[open] { border-color: var(--primary-border); box-shadow: inset 3px 0 0 var(--primary); }
.doc-api[open] > summary { border-bottom: 1px solid var(--border); background: var(--primary-soft); }
.doc-api[open] > summary strong { font-weight: 600; }
.doc-api > summary a.badge { text-decoration: none; }
.doc-api > :not(summary) { max-width: calc(100% - 24px); margin: 10px 12px; }
.docs-body { display: grid; gap: 16px; min-width: 0; }
.doc-hero .eyebrow { display: block; margin-bottom: 6px; color: var(--link); font: 600 12px/1.3 var(--mono); letter-spacing: .12em; }
.doc-hero h3 { margin-bottom: 8px; font-size: 22px; font-weight: 600; }
.doc-hero .login-copy + .login-copy { margin-top: 8px; }
.doc-section, .doc-capability { scroll-margin-top: 80px; }
/* 快速开始：跑通后的三件事平铺一排；一键发消息的状态条 */
.done-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.done-item { display: grid; align-content: start; gap: 8px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.done-item .button { justify-self: start; }
.quick-send { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); font-size: 13.5px; }
.quick-send.ok { border-color: var(--success-border); background: var(--success-soft); color: var(--success-text); }
.quick-send.bad { border-color: var(--danger-border); background: var(--danger-soft); color: var(--danger-text); }
.quick-send .doc-try { margin-top: 10px; }
/* 快速开始页下方折叠起来的运行总览 */
.collapse-panel > summary { cursor: pointer; font-weight: 500; list-style: none; }
.collapse-panel > summary::-webkit-details-marker { display: none; }
.collapse-panel > summary::before { content: "▸ "; color: var(--muted); }
.collapse-panel[open] > summary::before { content: "▾ "; }
.collapse-panel[open] > summary { margin-bottom: 12px; }
#quickstart-overview-body .page-head { display: none; }
.sampling-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 12px 0 8px; }
/* 可点击的统计卡 */
.metric.clickable { width: 100%; text-align: left; border: 1px solid var(--border); cursor: pointer; transition: border-color .2s, box-shadow .2s, transform .1s; }
.metric.clickable:hover { border-color: var(--primary-border); box-shadow: var(--shadow-pop); }
.metric.clickable:active { transform: translateY(1px); }
@media (max-width: 860px) { .done-row { grid-template-columns: minmax(0, 1fr); } }
.doc-section > p + p, .doc-section > .table-wrap + p, .doc-section > .code-block + p, .doc-section > p + .table-wrap { margin-top: 12px; }
.doc-h4 { margin: 20px 0 8px; font-size: 15px; font-weight: 600; }
.doc-label { margin: 16px 0 6px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.doc-list { display: grid; gap: 6px; margin: 12px 0 0; padding-left: 20px; color: var(--text-2); line-height: 1.7; }
.doc-list strong, .doc-list code { color: var(--text); }
.doc-table { font-size: 13.5px; }
.doc-table th { padding: 10px 12px; font-size: 13.5px; }
.doc-table td { padding: 10px 12px; }
.doc-table td:first-child { white-space: nowrap; }
.doc-table td span, .doc-table td strong { display: inline-flex; margin: 0; }
.doc-flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.doc-flow-step { display: grid; align-content: start; gap: 6px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); white-space: normal; }
.doc-flow-n { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff; font: 600 12px/1 var(--mono); }
.doc-flow-step p { font-size: 13px; }
.doc-prereq { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.doc-prereq-item { display: grid; align-content: start; gap: 8px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.doc-prereq-item p { font-size: 13px; }
.doc-prereq-item .button { justify-self: start; }
/* 能力卡片默认折叠：一行显示能力名、标题与读写标记，点开看字段与示例；同一时间只展开一张 */
.doc-capability { padding: 10px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.doc-capability + .doc-capability { margin-top: 8px; }
.doc-capability-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.doc-capability > summary { cursor: pointer; list-style: none; }
.doc-capability > summary::-webkit-details-marker { display: none; }
.doc-capability > summary > div { flex: 1; min-width: 0; }
.doc-capability > summary::before { content: "▸"; color: var(--muted); font-size: 12px; }
.doc-capability[open] > summary::before { content: "▾"; }
.doc-capability[open] { border-color: var(--primary-border); box-shadow: inset 3px 0 0 var(--primary); }
.doc-capability[open] > summary { margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.doc-capability-head strong { display: block; margin-top: 2px; font-size: 15px; font-weight: 600; color: var(--primary); }
.doc-capability > summary:hover strong { color: var(--primary-hover); }
.doc-cap-name { padding: 0 !important; background: none !important; color: var(--link); font-size: 12.5px; }
.doc-event + .doc-event { margin-top: 12px; }
.doc-event p { margin-bottom: 6px; }
.doc-faq { display: grid; gap: 8px; }
.doc-faq .help-details { margin: 0; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); }
.doc-faq .help-details summary { color: var(--text); font-size: 14px; }
.doc-samples + .doc-samples { margin-top: 20px; }
.doc-samples h4 { margin: 16px 0 4px; font-size: 15px; font-weight: 600; }
.doc-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.doc-tab { height: 30px; padding: 0 12px; border: 1px solid var(--border-strong); border-bottom: 0; border-radius: 6px 6px 0 0; background: transparent; color: var(--text-2); font-size: 13px; }
.doc-tab:hover { color: var(--link); }
.doc-tab.on { border-color: var(--code-bar); background: var(--code-bar); color: var(--code-text); }
.doc-pane .code-block { margin-top: 0; border-top-left-radius: 0; }
/* 多语言代码块：17 个语言标签单行横向滚动，不把代码块顶成三四行标签 */
.code-multi { min-width: 0; max-width: 100%; margin-top: 10px; }
/* 单行标签的最小内容宽度很大，所在的 grid 项必须允许收缩，否则整个弹窗被撑出横向滚动条 */
.playground-request { min-width: 0; }
/* 订单状态下的原因/备注单行省略，完整内容看悬停提示，避免把状态列撑宽、把操作列挤出可视区 */
.orders-table .row-note { display: block; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.code-multi .doc-tabs { flex-wrap: nowrap; margin-top: 0; overflow-x: auto; scrollbar-width: thin; }
.code-multi .doc-tab { flex: none; }
.doc-demo-line { margin-top: 8px; font-size: 13px; }
.code-actions { display: inline-flex; gap: 6px; }
.playground-key-row { display: flex; align-items: flex-end; gap: 8px; }
.playground-key-row label { flex: 1; min-width: 0; }
.doc-try { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }
.doc-try .login-copy { font-size: 13px; }

/* 代码块在两种主题下都保持深色，便于阅读 */
.code-block { margin-top: 10px; overflow: hidden; border-radius: var(--radius); background: var(--code-bg); }
.code-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 8px 6px 14px; background: var(--code-bar); }
.code-lang { color: #94a3b8; font: 600 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.code-block pre { margin: 0; padding: 12px 14px; overflow-x: auto; color: var(--code-text); font: 12.5px/1.65 var(--mono); }
.code-block code { padding: 0; background: none; color: inherit; font-size: inherit; }
.code-copy { height: 24px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, .15); border-radius: 4px; background: transparent; color: #cbd5e1; font-size: 12px; white-space: nowrap; }
.code-copy:hover { border-color: rgba(255, 255, 255, .35); color: #fff; }

/* ---------------------------------------------------------------- 动效与响应式 */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }

@media (max-width: 1200px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .content-grid.main-side, .content-grid.side-main { grid-template-columns: minmax(0, 1fr); }
  .stepper, .doc-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .settings-top, .split, .doc-prereq, .playground-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .docs-toc { position: static; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); max-height: none; }
  .docs-toc .doc-toc-sub { display: none; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; top: 0; left: 0; width: 208px !important; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: 8px 0 24px rgba(0, 0, 0, .25); }
  .sidebar.open + .sidebar-mask { position: fixed; inset: 0; z-index: 35; display: block; background: var(--backdrop); }
  :root[data-sider="collapsed"] .sidebar .nav-label, :root[data-sider="collapsed"] .sidebar .brand-name { display: block !important; }
  :root[data-sider="collapsed"] .nav-item { justify-content: flex-start; padding: 0 16px; }
  .sider-collapse { display: none; }
  .menu-button { display: inline-grid; }
  .topbar { padding: 0 8px; }
  .health-pill em, .user-text, .session-expiry { display: none; }
  main { padding: 0 12px 16px; }
  .page-head { margin: 0 -12px; padding: 14px 16px; }
  .toolbar, .guide { padding: 12px 16px; }
  .panel { padding: 16px; }
  .panel.flush > .panel-head { padding: 12px 16px; }
  .form-grid, .form-grid.three { grid-template-columns: minmax(0, 1fr); }
  .search { width: 100%; }
  #global-message { top: 64px; }
}
@media (max-width: 560px) {
  .stepper, .doc-flow { grid-template-columns: minmax(0, 1fr); }
  .metrics { gap: 10px; }
  .metric { padding: 14px 16px; }
  .metric strong { font-size: 24px; }
  .metric-icon { display: none; }
}

/* 扫码弹窗里的设备类型选择：一行摆开，不抢二维码的视觉重心。 */
.qr-login-type { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 13px; }
.qr-login-type select { padding: 4px 8px; border-radius: 6px; border: 1px solid var(--line, #ddd); background: transparent; color: inherit; }
.qr-login-type-hint { color: var(--muted, #888); font-size: 12px; }

/* 当前这张码的实际设备类型。与所选类型不一致时标红——看着下拉写 Windows、扫的却是 iPad 的码，白扫两轮。 */
.qr-login-type-current { color: var(--muted, #888); font-size: 12px; }
.qr-login-type-current.mismatch { color: #e74c3c; font-weight: 600; }

/* 状态徽标当按钮用：外观与普通徽标一致，只多一个手型和悬停反馈，
   免得现场看到状态却不知道它可以点。 */
.badge-action { cursor: pointer; border: none; font: inherit; }
.badge-action:hover { filter: brightness(1.08); text-decoration: underline; }

/* 手机出口状态灯。出口掉线时账号会跟着全断，这盏灯就贴在出口名字前面。 */
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-good { background: #27ae60; }
.dot-warn { background: #f39c12; }
.dot-bad { background: #e74c3c; }
.dot-idle { background: var(--muted, #bbb); }

/* 二维码上方的「该扫哪个号」。与扫码后那块（.qr-scanned）同一套视觉，
   区别只在它出现在扫之前，用来防扫错号。 */
.qr-target { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); text-align: left; }
.qr-target-avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.qr-target-text { display: flex; flex-direction: column; min-width: 0; }
.qr-target-text strong { font-size: 13.5px; }
.qr-target-text .mono { font-size: 12px; color: var(--muted); word-break: break-all; }
