/*
 * 开发文档页面样式（公开页面 /docs，独立于用户中心布局）。
 * 布局：固定顶栏 + 左侧两级目录 + 正文分节阅读 / 展开全部。
 * 企业级极简：白底、1px 边框、0–4px 圆角、阴影不超过 0 1px 2px rgba(0,0,0,.05)、单一品牌蓝 + 中性灰阶；代码块使用浅色背景。
 * 复用 resources/css/app.css 的变量与 .button、.brand-mark、.sr-only、.skip-link，其余类名统一以 docs- 为前缀。
 *
 * 断点：≥1200 桌面；1024–1199 小屏桌面 / iPad 横屏（侧栏收窄）；768–1023 iPad 竖屏（侧栏改为抽屉）；
 *       ≤767 手机（搜索收起为图标、表格按 data-label 卡片化）。
 */

/* ==================== 基础 ==================== */

/* app.css 给 html 设置了平滑滚动，本页切换章节需要立即定位，平滑滚动由脚本按需指定 */
.docs-html {
    background: var(--card);
    scroll-behavior: auto;
}

.docs-body {
    --docs-topbar-height: 56px;
    --docs-sidebar-width: 260px;
    --docs-gutter: 48px;
    --docs-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    background: var(--card);
}

/* 脚本按需显示的元素（搜索、模式切换、复制按钮、标签栏）在显示前保持隐藏 */
.docs-body [hidden] {
    display: none !important;
}

body.docs-drawer-open {
    overflow: hidden;
}

.docs-icon-button {
    display: inline-flex;
    width: 36px;
    height: 36px;
    flex: none;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--radius);
    background: transparent;
    color: var(--muted);
}

.docs-icon-button:hover {
    background: var(--page);
    color: var(--brand-strong);
}

/* ==================== 顶栏 ==================== */

.docs-topbar {
    position: fixed;
    z-index: 40;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    align-items: center;
    gap: 16px;
    height: var(--docs-topbar-height);
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: var(--card);
}

.docs-menu-button,
.docs-search-trigger {
    display: none;
}

.docs-brand {
    display: flex;
    min-width: 0;
    flex: none;
    align-items: center;
    gap: 12px;
}

.docs-brand-link {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 10px;
    border-radius: var(--radius);
    color: var(--text);
}

.docs-brand-mark {
    width: 30px;
    height: 30px;
}

.docs-brand-name {
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

.docs-brand-link:hover .docs-brand-name {
    color: var(--brand-strong);
}

.docs-brand-divider {
    width: 1px;
    height: 16px;
    background: var(--border-strong);
}

.docs-brand-title {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

/* ---------- 搜索 ---------- */

.docs-search {
    position: relative;
    display: flex;
    min-width: 0;
    flex: 0 1 380px;
    align-items: center;
    margin-left: 16px;
}

.docs-search-icon {
    position: absolute;
    left: 11px;
    color: var(--subtle);
    pointer-events: none;
}

.docs-search-input {
    width: 100%;
    min-width: 0;
    height: 34px;
    padding: 0 64px 0 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--page);
    color: var(--text);
    font-size: 13px;
    outline: none;
    appearance: none;
}

.docs-search-input::placeholder {
    color: var(--subtle);
}

.docs-search-input:hover {
    border-color: var(--border-strong);
}

.docs-search-input:focus {
    border-color: var(--brand);
    background: var(--card);
}

/* 桌面端右侧是快捷键提示，隐藏浏览器自带的清除按钮；手机端恢复显示 */
.docs-search-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
}

.docs-search-kbd {
    position: absolute;
    right: 8px;
    padding: 0 6px;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--card);
    color: var(--subtle);
    font-family: inherit;
    font-size: 11px;
    line-height: 18px;
    pointer-events: none;
}

.docs-search-cancel {
    display: none;
}

.docs-search-panel {
    position: absolute;
    z-index: 45;
    top: calc(100% + 6px);
    right: 0;
    left: 0;
    max-height: min(440px, calc(100vh - var(--docs-topbar-height) - 24px));
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.docs-search-results {
    margin: 0;
    padding: 4px 0;
    list-style: none;
}

.docs-search-option {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 9px 14px 9px 12px;
    border-left: 2px solid transparent;
    cursor: pointer;
}

.docs-search-option + .docs-search-option {
    border-top: 1px solid var(--border);
}

.docs-search-option:hover {
    background: var(--page);
}

.docs-search-option[aria-selected="true"] {
    border-left-color: var(--brand);
    background: var(--brand-soft);
}

.docs-search-option-head {
    display: flex;
    min-width: 0;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.docs-search-option-title {
    min-width: 0;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
}

.docs-search-option-path {
    flex: none;
    color: var(--subtle);
    font-size: 12px;
}

.docs-search-option-snippet {
    display: -webkit-box;
    overflow: hidden;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.6;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

.docs-search-panel mark {
    padding: 0 1px;
    border-radius: 2px;
    background: #dbeafe;
    color: var(--brand-strong);
}

.docs-search-empty {
    margin: 0;
    padding: 20px 14px;
    color: var(--subtle);
    font-size: 13px;
    text-align: center;
    overflow-wrap: anywhere;
}

/* ---------- 右侧操作 ---------- */

.docs-topbar-actions {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.docs-mode-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.docs-mode-toggle:hover {
    border-color: #93c5fd;
    color: var(--brand-strong);
}

.docs-topbar-links {
    display: flex;
    align-items: center;
    gap: 8px;
}

.docs-topbar-link {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 8px;
    border-radius: var(--radius);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.docs-topbar-link:hover {
    color: var(--brand-strong);
}

.docs-topbar .button {
    min-height: 32px;
}

/* ==================== 左侧目录 ==================== */

.docs-sidebar {
    position: fixed;
    z-index: 30;
    top: var(--docs-topbar-height);
    bottom: 0;
    left: 0;
    display: flex;
    width: var(--docs-sidebar-width);
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--card);
}

.docs-sidebar-head,
.docs-sidebar-foot {
    display: none;
}

.docs-nav {
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 0 24px;
    scrollbar-width: thin;
}

/* 一级：业务分组（按钮展开 / 收起）；二级：章节链接 */
.docs-nav-groups {
    margin: 0;
    padding: 0;
    list-style: none;
}

.docs-nav-group + .docs-nav-group {
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border);
}

.docs-nav-group-title {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 38px;
    margin: 0;
    padding: 0 16px 0 24px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-align: left;
    cursor: pointer;
    user-select: none;
}

.docs-nav-group-title > span {
    min-width: 0;
}

.docs-nav-group-title:hover {
    background: var(--page);
}

.docs-nav-group-title:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.docs-nav-group.has-active > .docs-nav-group-title {
    color: var(--brand-strong);
}

.docs-nav-chevron {
    color: var(--subtle);
    transform: rotate(-90deg);
    transition: transform 0.15s ease;
}

.docs-nav-group-title[aria-expanded="true"] .docs-nav-chevron {
    transform: none;
}

/* 一级章节链接（常见问题、版本与更新）：外观同一级分组标题，当前章节时与章节链接一样高亮 */
.docs-nav-group-link {
    border-right: 2px solid transparent;
    text-decoration: none;
}

.docs-nav-group-link:hover {
    color: var(--brand-strong);
}

.docs-nav-group-link.is-active {
    border-right-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand-strong);
}

.docs-nav-list {
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
}

.docs-nav-link {
    display: flex;
    align-items: center;
    min-height: 34px;
    padding: 6px 16px 6px 36px;
    border-right: 2px solid transparent;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.docs-nav-link:hover {
    background: var(--page);
    color: var(--brand-strong);
}

.docs-nav-link.is-active {
    border-right-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand-strong);
    font-weight: 600;
}

.docs-nav-link:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

/* 二级：接口分类（按钮展开 / 收起）；三级：章节链接，比二级再缩进一级 */
.docs-nav-sub-title {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 34px;
    margin: 0;
    padding: 6px 16px 6px 36px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    text-align: left;
    cursor: pointer;
    user-select: none;
}

.docs-nav-sub-title > span {
    min-width: 0;
}

.docs-nav-sub-title:hover {
    background: var(--page);
    color: var(--brand-strong);
}

.docs-nav-sub-title:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.docs-nav-sub.has-active > .docs-nav-sub-title {
    color: var(--brand-strong);
}

.docs-nav-sub-title[aria-expanded="true"] .docs-nav-chevron {
    transform: none;
}

.docs-nav-sub-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.docs-nav-link-child {
    padding-left: 52px;
}

.docs-overlay {
    display: none;
}

/* ==================== 正文 ==================== */

.docs-main {
    min-height: 100vh;
    margin-left: var(--docs-sidebar-width);
    padding-top: var(--docs-topbar-height);
}

.docs-main:focus {
    outline: none;
}

.docs-content {
    display: flex;
    max-width: 960px;
    flex-direction: column;
    padding: 36px var(--docs-gutter) 72px;
}

.docs-section {
    min-width: 0;
}

/* 锚点定位时让出固定顶栏的高度 */
.docs-section,
.docs-section [id] {
    scroll-margin-top: calc(var(--docs-topbar-height) + 16px);
}

/* ---------- 分节阅读 / 展开全部 ---------- */

.docs-content.is-single .docs-section {
    display: none;
}

.docs-content.is-single .docs-section.is-current {
    display: block;
}

/* 脚本接管前（含禁用脚本）：按地址栏锚点显示对应章节；脚本接管后加 is-enhanced，改由 is-current 控制。
   三条规则分开写：不支持 :has() 的浏览器只丢弃含 :has() 的规则，锚点章节仍能显示 */
.docs-content.is-single:not(.is-enhanced) .docs-section:target {
    display: block;
}

.docs-content.is-single:not(.is-enhanced) .docs-section:has(:target) {
    display: block;
}

.docs-content.is-single:not(.is-enhanced):has(:target) .docs-section.is-current:not(:target):not(:has(:target)) {
    display: none;
}

.docs-content.is-expanded .docs-section + .docs-section {
    margin-top: 64px;
}

.docs-content.is-expanded .docs-pager {
    display: none;
}

/* ---------- 标题与段落 ---------- */

.docs-title {
    margin: 0 0 12px;
    color: var(--text);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.01em;
}

/* 导语与分组名都是 p，选择器需高于下方的 .docs-section p */
.docs-section .docs-lead {
    margin: 0 0 24px;
    color: var(--muted);
    font-size: 15px;
    line-height: 1.8;
}

.docs-section .docs-eyebrow {
    margin: 0 0 6px;
    color: var(--brand-strong);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
    letter-spacing: 0.04em;
}

.docs-section-title {
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 22px;
    font-weight: 600;
    line-height: 1.4;
}

.docs-title:focus,
.docs-section-title:focus {
    outline: none;
}

.docs-section h3 {
    margin: 32px 0 10px;
    color: var(--text);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
}

.docs-section h4 {
    margin: 22px 0 8px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
}

.docs-section p,
.docs-list {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.8;
}

/* app.css 的基础样式清除了列表符号，文档列表恢复显示 */
.docs-list {
    padding-left: 22px;
}

ul.docs-list {
    list-style: disc;
}

ol.docs-list {
    list-style: decimal;
}

.docs-list li + li {
    margin-top: 4px;
}

.docs-list li::marker {
    color: var(--subtle);
}

.docs-notes {
    margin-top: 12px;
    font-size: 13px;
}

/* 搜索结果定位到的内容块，短暂高亮 */
.docs-search-hit {
    border-radius: 2px;
    background: var(--brand-soft);
    outline: 2px solid #bfdbfe;
    outline-offset: 2px;
}

/* ==================== 文字元素 ==================== */

.docs-code,
.docs-pre,
.docs-kv dd,
.docs-endpoint code {
    font-family: var(--docs-mono);
}

.docs-code {
    padding: 1px 5px;
    border: 1px solid var(--border);
    border-radius: 2px;
    background: var(--page);
    color: var(--text);
    font-size: 0.92em;
    overflow-wrap: anywhere;
}

.docs-link {
    color: var(--brand-strong);
    font-weight: 600;
}

.docs-link:hover {
    text-decoration: underline;
}

.docs-link:focus-visible {
    border-radius: 2px;
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* 请求方法：GET 用信息蓝、POST 用成功绿，均为浅底深字，对比度 ≥ 4.5:1 */
.docs-method {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    padding: 1px 8px;
    border: 1px solid var(--border);
    border-radius: 2px;
    font-family: var(--docs-mono);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
}

.docs-method-get {
    border-color: #bfdbfe;
    background: var(--info-soft);
    color: var(--info);
}

.docs-method-post {
    border-color: #bbf7d0;
    background: var(--success-soft);
    color: var(--success);
}

.docs-method-put {
    border-color: #fed7aa;
    background: var(--warning-soft);
    color: var(--warning);
}

.docs-endpoint {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
    margin: 0 0 16px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--page);
}

.docs-endpoint code {
    min-width: 0;
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

/* ==================== 概述 ==================== */

.docs-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0;
    border-top: 1px solid var(--border);
    border-left: 1px solid var(--border);
}

.docs-fact {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.docs-fact-wide {
    grid-column: 1 / -1;
    background: var(--page);
}

.docs-fact dt {
    color: var(--subtle);
    font-size: 12px;
}

.docs-fact dd {
    margin: 0;
    color: var(--text);
    font-size: 13px;
    line-height: 1.7;
    overflow-wrap: anywhere;
}

.docs-fact-value {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.docs-fact-value .docs-code {
    background: var(--card);
    font-size: 13px;
}

/* ==================== 快速开始 ==================== */

.docs-steps {
    margin: 0;
    padding: 0;
    list-style: none;
}

.docs-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.docs-step:first-child {
    padding-top: 2px;
}

.docs-step-index {
    display: inline-flex;
    width: 24px;
    height: 24px;
    flex: none;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    background: var(--brand);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
}

.docs-step-body {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
}

.docs-step-body strong {
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

.docs-section .docs-step-body p {
    margin: 0;
    font-size: 13px;
    line-height: 1.7;
}

/* ==================== 提示框 ==================== */

.docs-callout {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-left: 3px solid var(--info);
    border-radius: 2px;
    background: var(--info-soft);
}

.docs-section .docs-callout p {
    min-width: 0;
    flex: 1 1 280px;
    margin: 0;
    color: var(--text);
    font-size: 13px;
    line-height: 1.7;
}

.docs-callout-warning {
    border-left-color: var(--warning);
    background: var(--warning-soft);
}

.docs-callout-actions {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    gap: 8px;
}

/* 「快速开始」按业务线列出应用数量 */
.docs-app-counts {
    display: flex;
    width: 100%;
    flex-direction: column;
    margin: 0;
    padding: 0;
    list-style: none;
}

.docs-app-count {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 8px 0;
}

.docs-app-count + .docs-app-count {
    border-top: 1px solid var(--border);
}

.docs-app-count:first-child {
    padding-top: 0;
}

.docs-app-count:last-child {
    padding-bottom: 0;
}

.docs-app-count .docs-callout-action {
    flex: none;
}

/* ==================== 表格 ==================== */

.docs-table-wrap {
    margin: 10px 0 0;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 2px;
    scrollbar-width: thin;
}

.docs-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.docs-table th {
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--page);
    color: var(--subtle);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.docs-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--muted);
    line-height: 1.7;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.docs-table tbody tr:last-child td {
    border-bottom: 0;
}

.docs-table tbody tr:hover {
    background: var(--page);
}

.docs-table .docs-col-name {
    width: 30%;
}

.docs-table .docs-col-type,
.docs-table .docs-col-required,
.docs-table .docs-col-status,
.docs-table .docs-col-method,
.docs-table .docs-col-line,
.docs-table .docs-col-label,
.docs-table .docs-col-chars,
.docs-table .docs-col-segments {
    white-space: nowrap;
}

/* ==================== 签名示例 ==================== */

.docs-kv {
    margin: 10px 0 0;
    border: 1px solid var(--border);
    border-radius: 2px;
}

.docs-kv > div {
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr);
    gap: 12px;
    padding: 9px 12px;
    border-bottom: 1px solid var(--border);
}

.docs-kv > div:last-child {
    border-bottom: 0;
}

.docs-kv dt {
    color: var(--subtle);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.8;
}

.docs-kv dd {
    min-width: 0;
    margin: 0;
    color: var(--text);
    font-size: 12.5px;
    line-height: 1.8;
    overflow-wrap: anywhere;
    word-break: break-all;
}

.docs-kv .is-result {
    background: var(--brand-soft);
}

.docs-kv .is-result dd {
    color: var(--brand-strong);
    font-weight: 600;
}

/* ==================== 代码块 ==================== */

.docs-code-block {
    min-width: 0;
    margin: 10px 0 0;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--page);
}

.docs-code-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 36px;
    padding: 0 6px 0 12px;
    border-bottom: 1px solid var(--border);
    border-radius: 4px 4px 0 0;
    background: var(--card);
}

.docs-code-lang {
    color: var(--subtle);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.docs-pre {
    margin: 0;
    padding: 12px 14px;
    overflow-x: auto;
    color: var(--text);
    font-size: 12.5px;
    line-height: 1.65;
    tab-size: 4;
    white-space: pre;
    scrollbar-width: thin;
}

.docs-pre:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.docs-copy {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 28px;
    padding: 0 8px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.docs-copy:hover {
    border-color: var(--border-strong);
    background: var(--card);
    color: var(--brand-strong);
}

.docs-copy:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 1px;
}

.docs-copy.is-copied {
    color: var(--success);
}

.docs-copy-bordered {
    border-color: var(--border-strong);
    background: var(--card);
}

/* ==================== 示例代码标签页 ==================== */

.docs-tablist {
    display: flex;
    margin-top: 12px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    scrollbar-width: none;
}

.docs-tab {
    flex: none;
    min-height: 40px;
    margin-bottom: -1px;
    padding: 0 16px;
    border: 0;
    border-bottom: 2px solid transparent;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.docs-tab:hover {
    color: var(--brand-strong);
}

.docs-tab[aria-selected="true"] {
    border-bottom-color: var(--brand);
    color: var(--brand-strong);
}

.docs-tab:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.docs-tab-panel + .docs-tab-panel {
    margin-top: 20px;
}

/* 标签页可用时由标签名称代替面板标题 */
.docs-tabs.is-enhanced .docs-sample-title {
    display: none;
}

.docs-tabs.is-enhanced .docs-tab-panel + .docs-tab-panel {
    margin-top: 0;
}

.docs-section .docs-sample-meta {
    margin: 12px 0 0;
    color: var(--subtle);
    font-size: 13px;
    line-height: 1.7;
}

/* ==================== 常见问题 ==================== */

.docs-faq {
    border-top: 1px solid var(--border);
}

.docs-faq-item {
    border-bottom: 1px solid var(--border);
}

.docs-faq-item > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    padding: 10px 4px;
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.6;
    cursor: pointer;
    list-style: none;
}

.docs-faq-item > summary::-webkit-details-marker {
    display: none;
}

/* 展开指示：1.5px 描边的折角箭头 */
.docs-faq-item > summary::after {
    width: 8px;
    height: 8px;
    flex: none;
    margin-right: 6px;
    border-right: 1.5px solid var(--subtle);
    border-bottom: 1.5px solid var(--subtle);
    content: "";
    transform: rotate(45deg);
    transition: transform 0.15s ease;
}

.docs-faq-item[open] > summary::after {
    transform: rotate(-135deg);
}

.docs-faq-item > summary:hover {
    color: var(--brand-strong);
}

.docs-faq-item > summary:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: -2px;
}

.docs-faq-body {
    padding: 0 4px 14px;
}

.docs-faq-body .docs-list:last-child,
.docs-faq-body p:last-child {
    margin-bottom: 0;
}

/* ==================== 上一节 / 下一节 ==================== */

.docs-pager {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.docs-pager-link {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--card);
}

.docs-pager-link:hover {
    border-color: #93c5fd;
}

.docs-pager-link:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.docs-pager-link.is-next {
    grid-column: 2;
    align-items: flex-end;
    text-align: right;
}

.docs-pager-label {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--subtle);
    font-size: 12px;
}

.docs-pager-title {
    color: var(--brand-strong);
    font-size: 14px;
    font-weight: 600;
    overflow-wrap: anywhere;
}

/* ==================== 回到顶部 ==================== */

.docs-back-top {
    display: inline-flex;
    align-self: flex-end;
    align-items: center;
    min-height: 36px;
    margin-top: 24px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    background: var(--card);
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.docs-back-top:hover {
    border-color: #93c5fd;
    color: var(--brand-strong);
}

/* ==================== 1024–1199px：小屏桌面 / iPad 横屏 ==================== */

@media (max-width: 1199px) {
    .docs-body {
        --docs-sidebar-width: 240px;
        --docs-gutter: 32px;
    }

    .docs-search {
        flex-basis: 300px;
    }
}

/* ==================== ≤1023px：iPad 竖屏与手机，目录改为抽屉 ==================== */

@media (max-width: 1023px) {
    .docs-topbar {
        gap: 12px;
        padding: 0 16px 0 10px;
    }

    .docs-menu-button {
        display: inline-flex;
    }

    /* 品牌名只保留给读屏软件，顶栏留出搜索空间 */
    .docs-brand-name {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .docs-brand {
        gap: 10px;
    }

    .docs-brand-divider {
        display: none;
    }

    .docs-search {
        flex-basis: 320px;
        margin-left: 4px;
    }

    .docs-main {
        margin-left: 0;
    }

    .docs-sidebar {
        z-index: 50;
        top: 0;
        width: min(280px, 80vw);
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform 0.2s ease, visibility 0s linear 0.2s;
    }

    .docs-sidebar.is-open {
        transform: none;
        visibility: visible;
        transition: transform 0.2s ease;
    }

    .docs-sidebar-head {
        display: flex;
        flex: none;
        align-items: center;
        justify-content: space-between;
        height: var(--docs-topbar-height);
        padding: 0 6px 0 24px;
        border-bottom: 1px solid var(--border);
    }

    .docs-sidebar-title {
        color: var(--text);
        font-size: 15px;
        font-weight: 600;
    }

    .docs-nav {
        padding-top: 12px;
    }

    .docs-overlay {
        position: fixed;
        z-index: 45;
        inset: 0;
        display: block;
        background: rgba(15, 23, 42, 0.32);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s ease, visibility 0s linear 0.2s;
    }

    .docs-overlay.is-visible {
        opacity: 1;
        visibility: visible;
        transition: opacity 0.2s ease;
    }

    /* 触控尺寸 */
    .docs-icon-button {
        width: 44px;
        height: 44px;
    }

    .docs-nav-link,
    .docs-nav-group-title,
    .docs-nav-sub-title {
        min-height: 44px;
    }

    .docs-mode-toggle,
    .docs-topbar-link,
    .docs-topbar .button {
        min-height: 40px;
    }

    .docs-tab,
    .docs-copy,
    .docs-back-top {
        min-height: 44px;
    }

    .docs-callout-actions .button,
    .docs-app-count .button,
    .docs-pager-link {
        min-height: 44px;
    }

    .docs-faq-item > summary {
        min-height: 52px;
    }
}

/* ==================== ≤767px：手机 ==================== */

@media (max-width: 767px) {
    .docs-body {
        --docs-topbar-height: 52px;
        --docs-gutter: 16px;
    }

    .docs-topbar {
        gap: 4px;
        padding: 0 4px 0 4px;
    }

    .docs-brand-mark {
        width: 28px;
        height: 28px;
    }

    .docs-topbar-actions {
        display: none;
    }

    .docs-search {
        display: none;
    }

    .docs-search-trigger {
        display: inline-flex;
        margin-left: auto;
    }

    /* 搜索模式：搜索框覆盖整个顶栏，结果铺满顶栏以下区域 */
    .docs-topbar.is-searching .docs-search {
        position: absolute;
        z-index: 2;
        inset: 0;
        display: flex;
        gap: 4px;
        margin: 0;
        padding: 0 4px 0 12px;
        background: var(--card);
    }

    .docs-topbar.is-searching .docs-search-icon {
        left: 23px;
    }

    .docs-search-input {
        height: 40px;
        padding-right: 8px;
        font-size: 16px;
    }

    .docs-search-input::-webkit-search-cancel-button {
        -webkit-appearance: searchfield-cancel-button;
        appearance: auto;
    }

    .docs-search-kbd {
        display: none;
    }

    .docs-search-cancel {
        display: inline-flex;
        flex: none;
        align-items: center;
        min-height: 44px;
        padding: 0 10px;
        border: 0;
        background: transparent;
        color: var(--brand-strong);
        font-size: 15px;
        font-weight: 600;
    }

    .docs-search-panel {
        position: fixed;
        top: var(--docs-topbar-height);
        max-height: calc(100vh - var(--docs-topbar-height));
        border-width: 0 0 1px;
        border-radius: 0;
    }

    .docs-search-option {
        padding: 12px 16px 12px 14px;
    }

    /* 抽屉：手机上收窄并压缩行高，保留 ≥36px 触控高度 */
    .docs-sidebar {
        width: min(260px, 76vw);
    }

    .docs-sidebar-head {
        height: 48px;
        padding: 0 4px 0 16px;
    }

    .docs-sidebar-title {
        font-size: 14px;
    }

    .docs-sidebar-head .docs-icon-button {
        width: 40px;
        height: 40px;
    }

    .docs-nav {
        padding: 6px 0 12px;
    }

    .docs-nav-group + .docs-nav-group {
        margin-top: 2px;
        padding-top: 2px;
    }

    .docs-nav-group-title {
        min-height: 40px;
        padding: 0 12px 0 16px;
        font-size: 13px;
    }

    .docs-nav-sub-title,
    .docs-nav-link {
        min-height: 36px;
        padding: 4px 12px 4px 28px;
        font-size: 13px;
    }

    .docs-nav-link-child {
        padding-left: 40px;
    }

    /* 抽屉底部：阅读模式与站点入口 */
    .docs-sidebar-foot {
        display: flex;
        flex: none;
        flex-direction: column;
        gap: 6px;
        padding: 8px 12px 12px;
        border-top: 1px solid var(--border);
    }

    .docs-sidebar-foot .docs-mode-toggle {
        width: 100%;
        min-height: 36px;
        font-size: 13px;
    }

    .docs-sidebar-links {
        display: grid;
        grid-auto-columns: minmax(0, 1fr);
        grid-auto-flow: column;
        gap: 6px;
    }

    .docs-sidebar-links .button {
        min-height: 36px;
        padding: 0 6px;
        font-size: 13px;
    }

    /* ---------- 正文 ---------- */

    .docs-content {
        padding: 20px var(--docs-gutter) 48px;
    }

    .docs-title {
        font-size: 22px;
    }

    .docs-section .docs-lead {
        font-size: 14px;
    }

    .docs-section-title {
        font-size: 18px;
    }

    .docs-section h3 {
        margin-top: 24px;
    }

    .docs-content.is-expanded .docs-section + .docs-section {
        margin-top: 48px;
    }

    .docs-facts {
        grid-template-columns: minmax(0, 1fr);
    }

    .docs-kv > div {
        grid-template-columns: minmax(0, 1fr);
        gap: 2px;
    }

    .docs-pre {
        padding: 10px 12px;
        font-size: 12px;
    }

    .docs-callout {
        flex-direction: column;
        align-items: stretch;
    }

    .docs-section .docs-callout p {
        flex-basis: auto;
    }

    .docs-callout-actions {
        display: grid;
        grid-auto-columns: minmax(0, 1fr);
        grid-auto-flow: column;
    }

    .docs-app-count {
        flex-direction: column;
        align-items: stretch;
    }

    .docs-app-count .docs-callout-action {
        justify-content: center;
    }

    .docs-pager {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        margin-top: 32px;
    }

    .docs-pager-link.is-next {
        grid-column: auto;
    }

    .docs-back-top {
        align-self: stretch;
        justify-content: center;
    }

    /* 5 个语言标签在 360px 宽的手机上一行放下；更窄时标签栏可横向滑动 */
    .docs-tab {
        padding: 0 10px;
    }

    /* ---------- 表格按 data-label 卡片化 ---------- */

    .docs-table-wrap {
        overflow: visible;
        border: 0;
    }

    .docs-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }

    .docs-table,
    .docs-table tbody {
        display: block;
        width: 100%;
    }

    .docs-table tr {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px 12px;
        margin-bottom: 8px;
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 4px;
        background: var(--card);
    }

    .docs-table tbody tr:hover {
        background: var(--card);
    }

    .docs-table tbody tr:last-child {
        margin-bottom: 0;
    }

    .docs-table td,
    .docs-table tbody tr:last-child td {
        display: flex;
        width: auto;
        min-width: 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
        padding: 0;
        border: 0;
        color: var(--text);
        white-space: normal;
    }

    .docs-table td::before {
        color: var(--subtle);
        font-size: 12px;
        content: attr(data-label);
    }

    .docs-table td.is-wide {
        grid-column: 1 / -1;
    }
}

/* 触屏设备（含 iPad 横屏）：输入框字号不小于 16px，避免 iOS 聚焦时自动放大页面 */
@media (pointer: coarse) {
    .docs-search-input {
        font-size: 16px;
    }
}

/* 触屏 iPad：目录行保持 44px；手机抽屉使用上方 ≤767px 的紧凑尺寸 */
@media (pointer: coarse) and (min-width: 768px) {
    .docs-nav-link,
    .docs-nav-group-title,
    .docs-nav-sub-title {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .docs-sidebar,
    .docs-sidebar.is-open,
    .docs-overlay,
    .docs-overlay.is-visible,
    .docs-nav-chevron,
    .docs-faq-item > summary::after {
        transition: none;
    }
}
