/**
 * 六业芯动 全站 UI 规范 — CSS 变量与通用样式（HP-11）
 *
 * 用户偏好严格贯彻：
 * - 36px 高输入框 (--input-h)
 * - 8px 圆角按钮 (--radius-btn)
 * - 选中/未选中菜单背景区分 (--menu-active-bg)
 * - 卡片网格 16px 间距 (--grid-gap)
 * - 搜索框无边框无下划线 (--search-border)
 * - 弹窗输入 100% 宽 (--modal-input-w)
 * - 底部按钮右对齐 (--btn-align)
 * - 轻浅白背景 + 淡蓝色点缀的登录页风格
 * - 卡片视图默认
 * - 按钮配色：预览编辑浅灰、导出下载深蓝
 */

:root {
    /* 品牌色 */
    --color-primary: #1976D2;
    --color-primary-dark: #0D47A1;
    --color-primary-light: #E3F2FD;
    --color-primary-text: #1565C0;

    /* 中性色 */
    --color-text: #212121;
    --color-text-secondary: #616161;
    --color-text-muted: #9E9E9E;
    --color-border: #E0E0E0;
    --color-border-light: #F5F5F5;
    --color-bg: #FFFFFF;
    --color-bg-light: #FAFBFC;
    --color-bg-section: #F5F9FF;
    --color-bg-dark: #1A2332;

    /* 强调色 */
    --color-success: #2E7D32;
    --color-warning: #EF6C00;
    --color-danger: #C62828;

    /* 规格变量（对应 UI 偏好） */
    --input-h: 36px;
    --input-border: 1.5px solid var(--color-border);
    --input-radius: 6px;
    --input-font-size: 14px;
    --input-focus-bg: #F0F7FF;

    --radius-btn: 8px;
    --btn-gap: 8px;
    --btn-padding: 7px 14px;
    --btn-font-size: 12.5px;
    --btn-align: flex-end;

    --radius-card: 12px;
    --grid-gap: 16px;

    --side-margin: 20px;
    --container-max: 1200px;
    --section-padding-y: 72px;

    --search-border: none;

    --shadow-card: 0 2px 8px rgba(0,0,0,0.06);
    --shadow-card-hover: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-sider: 0 4px 16px rgba(0,0,0,0.08);

    --menu-active-bg: var(--color-primary-light);
    --menu-active-color: var(--color-primary-dark);

    /* 按钮配色规范：
       primary: 蓝色实色
       secondary: 白底浅灰边
       accent: 浅蓝底蓝字
       danger: 浅红底红字，悬停红实色 */
    --btn-primary-bg: var(--color-primary);
    --btn-primary-color: #FFF;
    --btn-secondary-bg: #FFF;
    --btn-secondary-color: var(--color-text-secondary);
    --btn-secondary-border: 1px solid var(--color-border);
    --btn-accent-bg: var(--color-primary-light);
    --btn-accent-color: var(--color-primary);

    /* 标签类型颜色（章节/资源不同视觉区分） */
    --tag-chapter-bg: #FFF3E0;
    --tag-chapter-color: #E65100;
    --tag-resource-bg: #E8F5E9;
    --tag-resource-color: #2E7D32;
    --tag-default-bg: #EDE7F6;
    --tag-default-color: #512DA8;

    /* 字体 */
    --font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

/* ====== Reset ====== */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; overflow-x: hidden; }
body {
    font-family: var(--font-family);
    font-size: 14px;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

/* ====== Container ====== */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--side-margin);
}
.section {
    padding: var(--section-padding-y) 0;
}

/* ====== 输入框（36px 高，1.5px 边，6px 圆角，14px 字） ====== */
.input, .input[type="text"], .input[type="search"], .input[type="password"], textarea.input, select.input {
    width: 100%;
    box-sizing: border-box;
    height: var(--input-h);
    padding: 0 12px;
    border: var(--input-border);
    border-radius: var(--input-radius);
    font-size: var(--input-font-size);
    background: #FFF;
    color: var(--color-text);
    transition: border-color .2s, background-color .2s, box-shadow .2s;
    outline: none;
    font-family: inherit;
}
.input:focus, textarea.input:focus, select.input:focus {
    border-color: var(--color-primary);
    background: var(--input-focus-bg);
    box-shadow: 0 0 0 3px rgba(25,118,210,0.1);
}
textarea.input { height: auto; min-height: 80px; padding: 8px 12px; resize: vertical; }

/* 搜索框（无边框无下划线） */
.search-input {
    border: var(--search-border) !important;
    border-bottom: none !important;
    background: transparent;
    box-shadow: none;
}
.search-input:focus {
    background: rgba(25,118,210,0.04);
}

/* ====== 按钮（8px 圆角，8px 间距，7px 14px 内边距，12.5px 字） ====== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: var(--btn-padding);
    border-radius: var(--radius-btn);
    font-size: var(--btn-font-size);
    font-weight: 500;
    line-height: 1.4;
    transition: all .2s ease;
    user-select: none;
    white-space: nowrap;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--btn-primary-bg);
    color: var(--btn-primary-color);
}
.btn-primary:hover { background: var(--color-primary-dark); }

.btn-secondary {
    background: var(--btn-secondary-bg);
    color: var(--btn-secondary-color);
    border: var(--btn-secondary-border);
}
.btn-secondary:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.btn-accent {
    background: var(--btn-accent-bg);
    color: var(--btn-accent-color);
}
.btn-accent:hover { opacity: .85; }

.btn-danger {
    background: #FFEBEE;
    color: var(--color-danger);
}
.btn-danger:hover { background: var(--color-danger); color: #FFF; }
.btn-success {
    background: #D1FAE5;
    color: #047857;
    border: 1.5px solid #6EE7B7;
}
.btn-success:hover { opacity: .85; }

.btn-lg {
    padding: 12px 24px;
    font-size: 15px;
    height: 44px;
    border-radius: var(--radius-btn);
}

/* 底部按钮右对齐 */
.btn-group-bottom {
    display: flex;
    justify-content: var(--btn-align);
    gap: var(--btn-gap);
}

/* ====== 卡片 ====== */
.card {
    background: var(--color-bg);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    transition: box-shadow .25s ease, transform .25s ease, border-color .25s ease;
    overflow: hidden;
}
.card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
    border-color: rgba(25,118,210,0.2);
}

.card-grid {
    display: grid;
    gap: var(--grid-gap);
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.card-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.card-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.card-grid.cols-5 { grid-template-columns: repeat(5, 1fr); }

/* ====== 标签（章节/资源 不同视觉区分） ====== */
.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}
.tag-chapter { background: var(--tag-chapter-bg); color: var(--tag-chapter-color); }
.tag-resource { background: var(--tag-resource-bg); color: var(--tag-resource-color); }
.tag-default { background: var(--tag-default-bg); color: var(--tag-default-color); }

/* ====== 菜单选中/未选中区分 ====== */
.nav-menu-item {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    color: var(--color-text-secondary);
    transition: all .18s;
    cursor: pointer;
}
.nav-menu-item:hover {
    background: var(--color-bg-light);
    color: var(--color-primary);
}
.nav-menu-item.active {
    background: var(--menu-active-bg);
    color: var(--menu-active-color);
    font-weight: 500;
}

/* ====== 通用排版 ====== */
.section-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text);
    text-align: center;
    margin-bottom: 10px;
}
.section-subtitle {
    font-size: 15px;
    color: var(--color-text-muted);
    text-align: center;
    margin-bottom: 48px;
}
.text-primary { color: var(--color-primary); }
.text-muted { color: var(--color-text-muted); }

/* ====== 响应式 ====== */
@media (max-width: 960px) {
    :root { --section-padding-y: 48px; --side-margin: 16px; }
    .card-grid.cols-4,
    .card-grid.cols-5 { grid-template-columns: repeat(2, 1fr); }
    .card-grid.cols-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .card-grid.cols-2,
    .card-grid.cols-3,
    .card-grid.cols-4,
    .card-grid.cols-5 { grid-template-columns: 1fr; }
    .section-title { font-size: 22px; }
}

/* ============================================================
 * 六业芯动 移动端基建（汉堡菜单 / 抽屉 / 底部导航 / bottom-sheet）
 * 设计原则：PC 端零影响；≤768px 渐进增强；触控目标 ≥44px
 * ============================================================ */

/* 按钮铺满容器（移动端表单常用） */
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ====== 汉堡按钮（仅移动端显示） ====== */
.navbar-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}
.navbar-hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--color-text-secondary);
    border-radius: 2px;
    transition: transform .25s ease, opacity .25s ease;
}

/* ====== 移动端抽屉遮罩 + 抽屉 ====== */
.mobile-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
    z-index: 1100;
}
.mobile-drawer-overlay.open {
    opacity: 1;
    visibility: visible;
}
.mobile-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 82%;
    max-width: 340px;
    height: 100vh;
    /* App 内置浏览器（抖音/微信等）可视区比 100vh 矮，底部（退出登录）会被顶出屏幕外：
       dvh 跟随动态可视高度；不支持 dvh 的旧内核回退 100vh；极端矮屏由 overflow 兜底滚动 */
    height: 100dvh;
    overflow-y: auto;
    background: #FFF;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    z-index: 1101;
    display: flex;
    flex-direction: column;
}
.mobile-drawer.open { transform: translateX(0); }

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border-light);
}
.mobile-drawer-logo {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.mobile-drawer-logo .logo-main {
    font-size: 20px;
    font-weight: 800;
    color: var(--color-primary-dark);
}
.mobile-drawer-logo .logo-brand {
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
}
.mobile-drawer-close {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 18px;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.mobile-drawer-close:active { background: var(--color-bg-light); }

.mobile-drawer-menu {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px;
}
.mobile-drawer-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 15px;
    color: var(--color-text);
    min-height: 48px;
    transition: background .15s;
}
.mobile-drawer-item .mdi-icon { font-size: 20px; }
.mobile-drawer-item:active { background: var(--color-bg-light); }
.mobile-drawer-item.active {
    background: var(--color-primary-light);
    color: var(--color-primary-dark);
    font-weight: 600;
}

.mobile-drawer-footer {
    padding: 16px;
    /* iPhone 底部指示条/抖音底栏安全距离，防止退出按钮贴边被遮 */
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--color-border-light);
    background: var(--color-bg-light);
}
.mobile-user-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mobile-user-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 4px;
}
.mobile-drawer-footer .btn { min-height: 44px; }

/* ====== 底部固定导航栏 ====== */
.bottom-nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 62px;
    background: #FFF;
    border-top: 1px solid var(--color-border-light);
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
    z-index: 900;
    padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav.active-visible { display: flex; }
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 0;
    color: #1F2937;
    font-size: 13px;
    font-weight: 500;
    position: relative;
    min-height: 44px;
    text-decoration: none;
}
/* 图标 + 文字胶囊容器：选中态蓝底白字 */
.bottom-nav-item .bn-pill {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 5px 18px;
    border-radius: 16px;
    transition: background .2s ease, color .2s ease;
}
/* 黑白单色 SVG 图标（随 currentColor 变色） */
.bottom-nav-item .bn-icon {
    position: relative;
    line-height: 1;
    color: #111827;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bottom-nav-item .bn-icon svg { width: 24px; height: 24px; display: block; }
.bottom-nav-item .bn-label { line-height: 1; }
/* 选中态：蓝底胶囊 + 白色图标/文字 */
.bottom-nav-item.active { color: #FFF; }
.bottom-nav-item.active .bn-pill { background: var(--color-primary); }
.bottom-nav-item.active .bn-icon { color: #FFF; }
.bottom-nav-item .bn-badge {
    position: absolute;
    top: -5px;
    right: -8px;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--color-danger);
    color: #FFF;
    font-size: 11px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    border: 1.5px solid #FFF;
}

/* 页面内容为底部导航留出空间（移动端） */
body.has-bottom-nav { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }

/* ====== 模态框 bottom-sheet（移动端） ====== */
.modal-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    width: 100%;
    max-width: 100%;
    max-height: 88vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    padding-bottom: env(safe-area-inset-bottom);
}
.modal-sheet.open { transform: translateY(0); }
.modal-sheet .modal-header {
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 2;
    border-radius: 16px 16px 0 0;
}
.modal-sheet .modal-body { overflow-y: auto; }

/* ====== 分享面板（bottom-sheet，通用） ====== */
.share-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .28s ease, visibility .28s ease;
    z-index: 1100;
}
.share-sheet-overlay.open { opacity: 1; visibility: visible; }
.share-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #FFF;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    z-index: 1101;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
}
.share-sheet.open { transform: translateY(0); }
.share-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--color-border-light);
}
.ss-title { font-size: 16px; font-weight: 600; color: var(--color-text); }
.ss-close {
    width: 32px; height: 32px;
    border-radius: 8px;
    font-size: 16px;
    color: var(--color-text-secondary);
    display: flex; align-items: center; justify-content: center;
}
.share-sheet-body { padding: 20px; overflow-y: auto; }
.ss-qr-wrap {
    text-align: center;
    margin-bottom: 20px;
}
.ss-qr-wrap img {
    width: 180px; height: 180px;
    margin: 0 auto;
    border-radius: 12px;
    border: 1px solid var(--color-border-light);
    padding: 8px;
    background: #FFF;
}
.ss-qr-tip { margin-top: 10px; font-size: 13px; color: var(--color-text-secondary); }
.ss-link-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.ss-link-input {
    flex: 1;
    height: 44px;
    padding: 0 12px;
    border: 1.5px solid var(--color-border-light);
    border-radius: 8px;
    font-size: 13px;
    background: var(--color-bg-light);
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ss-link-row .btn { flex-shrink: 0; min-height: 44px; }
.ss-share-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}
.ss-share-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px;
    border-radius: 10px;
    background: var(--color-bg-light);
    font-size: 12px;
    color: var(--color-text);
    min-height: 64px;
}
.ss-share-btn:active { background: var(--color-border-light); }
.ss-si { font-size: 22px; line-height: 1; }
.ss-note {
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
    line-height: 1.5;
}
.ss-poster-btn {
    width: 100%;
    min-height: 44px;
    margin-bottom: 12px;
    font-size: 14px;
}

/* ====== 推广海报弹层（复用 bottom-sheet 定位） ====== */
.poster-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #FFF;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
    transform: translateY(100%);
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    z-index: 1101;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    padding-bottom: env(safe-area-inset-bottom);
}
.poster-sheet.open { transform: translateY(0); }
.poster-sheet-body {
    padding: 16px 20px 20px;
    overflow-y: auto;
    text-align: center;
}
.poster-canvas-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}
.poster-canvas-wrap img {
    max-width: 100%;
    max-height: 66vh;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.18);
}
.poster-loading {
    color: var(--color-text-muted);
    font-size: 14px;
    padding: 60px 0;
}
.poster-save-tip {
    margin: 14px 0 4px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

/* PC 端：分享面板 & 海报改为居中对话框 */
@media (min-width: 769px) {
    .share-sheet, .poster-sheet {
        left: 50%;
        right: auto;
        bottom: auto;
        top: 50%;
        transform: translate(-50%, 100vh);
        width: 440px;
        max-width: 90vw;
        border-radius: 16px;
    }
    .share-sheet.open, .poster-sheet.open { transform: translate(-50%, -50%); }
    .poster-canvas-wrap img { max-height: 60vh; }
}

/* ====== 阅读助手：顶部进度条 + 返回顶部 ====== */
#readProgressBar {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    background: linear-gradient(90deg, #2563EB, #7C3AED);
    z-index: 1200;
    transition: width .12s linear;
    pointer-events: none;
}
#backToTop {
    position: fixed;
    right: 16px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #1E40AF;
    color: #fff;
    font-size: 20px;
    line-height: 1;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.35);
    z-index: 900;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .25s ease, transform .25s ease, visibility .25s;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
#backToTop.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
#backToTop:active { background: #1E3A8A; }
/* PC 端放在右下角常规位置 */
@media (min-width: 769px) {
    #backToTop {
        right: 28px;
        bottom: 28px;
    }
}

/* 表格横向滚动包裹（由 partials.js 自动注入） */
.table-scroll {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-scroll > table { min-width: 100%; }
/* Tab 横向滚动 */
.tabs-scroll {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
}
.tabs-scroll::-webkit-scrollbar { display: none; }
.tabs-scroll > * { flex-shrink: 0; }

/* ============================================================
 * 移动端断点
 *   ≤960px：平板（已有卡片栅格重排）
 *   ≤768px：大手机（汉堡菜单出现、底部导航出现）
 *   ≤480px：小手机（单列、压缩间距）
 * ============================================================ */
@media (max-width: 768px) {
    /* 汉堡按钮显示，桌面菜单隐藏 */
    .navbar-hamburger { display: flex; }
    .navbar-menu { display: none !important; }
    /* 底部导航显示 */
    .bottom-nav { display: flex; }
    body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
    /* 桌面端用户下拉在移动端收起，改用抽屉内入口 */
    .navbar-right .user-menu { display: none; }
    /* 未登录时右上角「登录/注册」按钮移动端隐藏（底部导航"我的/消息"与汉堡抽屉底部均有登录入口） */
    .navbar-guest-login { display: none !important; }
    /* 触控目标加大 */
    .btn { min-height: 44px; }
    .nav-menu-item { min-height: 44px; display: flex; align-items: center; }
    .dropdown-item { min-height: 44px; }
    /* 输入框加高到 44px 便于触控 */
    .input, .input[type="text"], .input[type="search"], .input[type="password"], select.input {
        height: 44px;
        font-size: 15px;
    }
    /* section 间距压缩 */
    :root { --section-padding-y: 40px; --side-margin: 16px; }
    /* 卡片多列 → 2 列 */
    .card-grid.cols-3,
    .card-grid.cols-4,
    .card-grid.cols-5 { grid-template-columns: repeat(2, 1fr); }
    /* 标题缩放 */
    .section-title { font-size: 24px; }
    /* 表格横滑兜底（JS 已自动包裹 .table-scroll，此处做最终保险） */
    table { max-width: 100%; }
}

@media (max-width: 768px) {
    /* 全部单列 */
    .card-grid.cols-2,
    .card-grid.cols-3,
    .card-grid.cols-4,
    .card-grid.cols-5 { grid-template-columns: 1fr; }
    :root { --section-padding-y: 32px; --side-margin: 12px; --grid-gap: 12px; }
    .section-title { font-size: 20px; }
    .section-subtitle { font-size: 13px; margin-bottom: 28px; }
    /* 按钮组纵向排列 */
    .btn-group-bottom { flex-direction: column; align-items: stretch; }
    .btn-group-bottom .btn { width: 100%; }
    /* 模态框在移动端强制 bottom-sheet（.modal 为遮罩，.modal-content 为对话框） */
    .modal { align-items: flex-end; }
    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 88vh;
        border-radius: 16px 16px 0 0;
    }
    .modal-body { padding: 16px; }
    .modal-footer {
        padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
        flex-direction: column;
        gap: 8px;
    }
    .modal-footer .btn { width: 100%; min-height: 44px; }
    .modal-form-row input, .modal-form-row select, .modal-form-row textarea {
        height: 44px; font-size: 16px;
    }
    /* 认证弹框（cert-modal）移动端 bottom-sheet */
    .cert-modal .cert-modal-dialog {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        top: auto;
        width: 100%;
        max-width: 100%;
        max-height: 88vh;
        margin: 0;
        border-radius: 16px 16px 0 0;
        overflow-y: auto;
        padding-bottom: env(safe-area-inset-bottom);
    }
}
