/* ============================================================
   共享响应式层 responsive.css
   - 目标：三套控制台(admin 管理后台 / agent 代理 / web 用户)在手机上都能顺手用
   - 只做"窄屏基线"：Element Plus 弹窗/抽屉/表单/表格/分页/通知的移动端行为，
     以及 .mobile-only/.desktop-only 显隐工具类（"不同显示方式"）。
   - 加载顺序：theme.css 之后、各页面内联 <style> 之前。
     → admin/web 已有更细的内联断点会覆盖本层同名规则（内联在后、同特异度，后来居上）；
       agent 缺这些规则，正好由本层补齐。表格/分页/通知本层是各页唯一来源，全局生效。
   - 桌面(>768px)基本不干预，避免影响既有宽屏布局。
   ============================================================ */

/* ---------- 显隐工具类：同一份 DOM，手机/桌面显示不同 ---------- */
.mobile-only, .m-only { display: none !important; }
@media (max-width: 900px) {
    .desktop-only, .d-only { display: none !important; }
    .mobile-only, .m-only { display: revert !important; }
    /* 需要按 flex/grid 呈现的手机专用块，用 .mobile-flex/.mobile-grid 兜住 display */
    .mobile-flex { display: flex !important; }
    .mobile-grid { display: grid !important; }
}

/* ---------- 一行式工具栏：任何宽度都允许换行 ----------
   设备页/代理页的「搜索框 + 多个按钮」在 1024 这类中等宽度也会挤爆
   （实测 .bar-wrap clientWidth 696 / 内容 789，把整页推出 44px），
   所以换行不能只写在窄屏断点里；宽屏放得下时自然不会换行。 */
.bar-wrap { flex-wrap: wrap; }

/* ---------- ≤992px：表格紧凑化（列多时靠 Element 内部横向滚动，减小内距/字号） ---------- */
@media (max-width: 992px) {
    .el-table { font-size: 13px; }
    .el-table .cell { padding: 0 8px; }
    .el-table th.el-table__cell, .el-table td.el-table__cell { padding: 8px 6px; }
    .el-table .el-button--small, .el-table .el-button.is-link { padding: 4px 6px; }
    /* 描述列表在窄屏允许换行，避免整块溢出 */
    .el-descriptions__body .el-descriptions__table { table-layout: auto; }
}
@media (max-width: 640px) {
    .el-table { font-size: 12.5px; }
    .el-table th.el-table__cell, .el-table td.el-table__cell { padding: 7px 5px; }
    .el-table .cell { padding: 0 6px; }
}

/* ---------- ≤768px：弹窗 / 抽屉 / 消息框 / 通知 贴合窄屏 ---------- */
@media (max-width: 768px) {
    .el-dialog {
        width: 92% !important; max-width: 92vw;
        margin: 6vh auto !important;
    }
    .el-dialog.is-fullscreen { width: 100% !important; max-width: 100vw; margin: 0; }
    .el-dialog__header { padding: 14px 16px; }
    .el-dialog__body { padding: 14px 16px; max-height: 68vh; overflow-y: auto; }
    .el-dialog__footer { padding: 12px 16px; }
    .el-message-box { width: 88% !important; max-width: 88vw; }
    .el-drawer.rtl, .el-drawer.ltr { width: 100% !important; }
    .el-drawer__body { padding: 12px 14px; }
    .el-notification { width: 92vw !important; min-width: 0; }
    .el-message { min-width: 0; width: 92vw; max-width: 92vw; }
}

/* ---------- ≤768px：表单控件与工具栏贴合窄屏 ---------- */
@media (max-width: 768px) {
    /* 只拉伸表单内容区的直接控件；卡片、工具栏里的行内选择器保留自身宽度 */
    .el-form-item__content > .el-input,
    .el-form-item__content > .el-select,
    .el-form-item__content > .el-textarea,
    .el-form-item__content > .el-input-number,
    .el-form-item__content > .el-date-editor.el-input,
    .el-form-item__content > .el-date-editor.el-input__wrapper { width: 100% !important; }
    .el-form-item__content { flex-wrap: wrap; }
    /* 单选/多选组换行，不再横向溢出 */
    .el-radio-group, .el-checkbox-group { display: flex; flex-wrap: wrap; gap: 6px 4px; }
    /* 弹窗底部按钮区可换行 */
    .el-dialog__footer { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
    .el-dialog__footer .el-button { margin-left: 0; }
    /* 表单/卡片里的行内 flex（搜索框+按钮等）允许换行；三端卡片类都要覆盖 */
    .panel [style*="display:flex"], .panel [style*="display: flex"],
    .ag-card [style*="display:flex"], .ag-card [style*="display: flex"],
    .el-card__body [style*="display:flex"], .el-card__body [style*="display: flex"],
    .el-dialog__body [style*="display:flex"], .el-dialog__body [style*="display: flex"],
    .el-drawer__body [style*="display:flex"], .el-drawer__body [style*="display: flex"] { flex-wrap: wrap; }
}

/* ---------- ≤640px：分页收拢（隐藏条数/跳页，居中换行） ---------- */
@media (max-width: 640px) {
    .el-pagination { flex-wrap: wrap; justify-content: center; row-gap: 6px; }
    .el-pagination .el-pagination__sizes,
    .el-pagination .el-pagination__jump { display: none; }
    .el-pagination.is-background .el-pager li { min-width: 30px; }
    /* 标签页头窄屏不挤压 */
    .el-tabs__header { margin-bottom: 12px; }
}

/* ---------- ≤768px 且 JS 已给 <html> 打 .mob-tbl：表格自动转「卡片列表」 ----------
   由 theme.js 表头引擎自动写 data-label 后生效；某表想保留网格加 .table-keep。
   仅 html.mob-tbl 命中，桌面与无 JS 环境保持上面的横向滚动基线。 ---------- */
@media (max-width: 768px) {
    html.mob-tbl .el-table:not(.table-keep) .el-table__header-wrapper { display: none !important; }
    html.mob-tbl .el-table:not(.table-keep) .el-table__fixed,
    html.mob-tbl .el-table:not(.table-keep) .el-table__fixed-right { display: none !important; }
    html.mob-tbl .el-table:not(.table-keep) colgroup { display: none; }
    html.mob-tbl .el-table:not(.table-keep) .el-table__body-wrapper,
    html.mob-tbl .el-table:not(.table-keep) .el-scrollbar__wrap {
        overflow: visible !important; max-height: none !important;
    }
    /* 卡片左右内距放在 body-wrapper（div，不受 table-part 限制） */
    html.mob-tbl .el-table:not(.table-keep) .el-table__body-wrapper {
        padding: 2px 10px; box-sizing: border-box;
    }
    html.mob-tbl .el-table:not(.table-keep) table.el-table__body { display: block; width: 100% !important; }
    /* tbody 纵向 flex：gap 有效，用来拉开卡片间距 */
    html.mob-tbl .el-table:not(.table-keep) tbody {
        display: flex; flex-direction: column; gap: 10px; width: 100%;
    }

    /* tr 只负责纵向堆叠（装饰在 table-part 上无效，改挂 td；不设底色以免圆角缺口被方角填住） */
    html.mob-tbl .el-table:not(.table-keep) tr.el-table__row {
        display: block; width: auto !important; min-width: 0;
    }
    /* 每个单元格 = 一行「标签 … 值」；左右描边 + 背景，多格拼成一张卡片 */
    html.mob-tbl .el-table:not(.table-keep) td.el-table__cell {
        display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
        width: auto !important; padding: 7px 12px !important; text-align: right;
        background: var(--surface, #fff);
        border: 1px solid var(--line, #e8ecf1); border-width: 0 1px;
    }
    /* 首格加顶边 + 顶部圆角，末格加底边 + 底部圆角 → 合成一张圆角卡片 */
    html.mob-tbl .el-table:not(.table-keep) tr.el-table__row > td.el-table__cell:first-child {
        border-top-width: 1px; border-top-left-radius: 12px; border-top-right-radius: 12px;
    }
    html.mob-tbl .el-table:not(.table-keep) tr.el-table__row > td.el-table__cell:last-child {
        border-bottom-width: 1px; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px;
    }
    html.mob-tbl .el-table:not(.table-keep) td.el-table__cell::before {
        content: attr(data-label); flex: 0 0 auto; max-width: 45%;
        font-weight: 600; color: var(--text-3, #8a94a6); font-size: 12.5px;
        text-align: left; white-space: normal; word-break: break-word;
    }
    html.mob-tbl .el-table:not(.table-keep) td.el-table__cell .cell {
        flex: 1 1 auto; min-width: 0; text-align: right;
        white-space: normal; word-break: break-word; line-height: 1.5;
    }
    /* 无标题列（选择/展开/序号/操作等）：不显示标签，值独占整行居中 */
    html.mob-tbl .el-table:not(.table-keep) td.el-table__cell:not([data-label])::before,
    html.mob-tbl .el-table:not(.table-keep) td.el-table__cell[data-label=""]::before { content: none; }
    html.mob-tbl .el-table:not(.table-keep) td.el-table__cell:not([data-label]) .cell,
    html.mob-tbl .el-table:not(.table-keep) td.el-table__cell[data-label=""] .cell {
        width: 100%; text-align: center; justify-content: center;
    }
    /* 卡片内多按钮/标签行居中排布 */
    html.mob-tbl .el-table:not(.table-keep) td.el-table__cell .cell {
        display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end;
    }
    html.mob-tbl .el-table:not(.table-keep) td.el-table__cell:not([data-label]) .cell,
    html.mob-tbl .el-table:not(.table-keep) td.el-table__cell[data-label=""] .cell { justify-content: center; }
    /* 纯文本值右对齐靠上；含交互元素的行靠 flex 排布 */
    html.mob-tbl .el-table:not(.table-keep) .el-table__empty-block { display: block; }
    /* 卡片模式下 el-scrollbar 默认 overflow:hidden + view 为 inline-block，
       会按未收缩的原始表宽撑出横向可滚区；这里收口为可见/块级，彻底消除残留溢出 */
    html.mob-tbl .el-table:not(.table-keep) .el-scrollbar { overflow: visible !important; }
    html.mob-tbl .el-table:not(.table-keep) .el-scrollbar__bar { display: none !important; }
    html.mob-tbl .el-table:not(.table-keep) .el-scrollbar__view { display: block !important; width: 100% !important; }
    /* 卡片里的文字型按钮（link / text）：桌面表格里 22px 高是合理的，
       但在卡片列表里它就是主要操作，实测 38×22 太难点 → 卡片模式下按 44 给 */
    html.mob-tbl .el-table:not(.table-keep) td.el-table__cell .el-button {
        min-width: 44px; min-height: 44px; padding-left: 10px; padding-right: 10px;
    }
}

/* ============================================================
   移动端「App 化」增强（仅窄屏命中，桌面零影响）
   - 目标：让后台在手机上更接近原生 App 的手感与观感——
     贴合刘海/小白条安全区、边缘到边缘的分组、磨砂标题栏、
     底部弹层(把对话框当 ActionSheet)、抽屉式导航、惯性滚动+隐藏滚动条、
     更大可点区域与按压反馈、去点击高亮/去 300ms 延迟。
   - 三端共用：admin(theme-admin) / web(theme-user) / agent(theme-agent) 一致。
   - 用 body[class*="theme-"] 抬特异度(0,2,1) 压过各页内联 <style> 的同名(0,1,0)规则。
   ============================================================ */

/* ---------- 通用触摸手感（窄屏） ---------- */
@media (max-width: 900px) {
    html { -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; }
    /* 去点击灰块高亮；交互元素禁双击缩放带来的 300ms 延迟 */
    body[class*="theme-"] * { -webkit-tap-highlight-color: transparent; }
    body[class*="theme-"] a,
    body[class*="theme-"] button, body[class*="theme-"] .el-button,
    body[class*="theme-"] .nav-item, body[class*="theme-"] .topbar-tab,
    body[class*="theme-"] .device-tab, body[class*="theme-"] .row-check,
    body[class*="theme-"] .tab, body[class*="theme-"] label.el-radio,
    body[class*="theme-"] .el-table__row { touch-action: manipulation; }
    /* 窄屏隐藏滚动条，视觉更像 App */
    body[class*="theme-"] ::-webkit-scrollbar { width: 0 !important; height: 0 !important; background: transparent; }
    body[class*="theme-"] * { scrollbar-width: none; -ms-overflow-style: none; }
    /* 主要滚动容器开启惯性滚动 */
    body[class*="theme-"] .content-area,
    body[class*="theme-"] .el-table__body-wrapper,
    body[class*="theme-"] .el-scrollbar__wrap,
    body[class*="theme-"] .el-dialog__body,
    body[class*="theme-"] .sidebar-nav { -webkit-overflow-scrolling: touch; }

    /* ---------- 吸顶标题栏 + 刘海安全区 + 标题省略 ----------
       移动端去磨砂：sticky/fixed 栏在滚动时每帧重绘 backdrop-filter，低端机掉帧主因。
       改近实色背景(.96)，视觉几乎一致、滚动恢复顺滑；桌面(>900)保留玻璃质感。 */
    body[class*="theme-"] .topbar {
        height: auto !important;
        min-height: calc(52px + env(safe-area-inset-top)) !important;
        padding: env(safe-area-inset-top) 12px 0 !important;
        background: rgba(255, 255, 255, .96) !important;
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        gap: 8px;
    }
    html.dark body[class*="theme-"] .topbar { background: rgba(22, 26, 33, .96) !important; }
    /* agent 顶栏是 .ag-top（非 .topbar），内联 blur(18px) 同样逐帧重绘，一并降级 */
    body.theme-agent .ag-top { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(255, 255, 255, .96); }
    html.dark body.theme-agent .ag-top { background: rgba(22, 26, 33, .96); }
    body[class*="theme-"] .topbar-left { min-width: 0; font-size: 15px; }
    body[class*="theme-"] .topbar-left > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    body[class*="theme-"] .topbar-right { flex-shrink: 0; gap: 10px; }
    /* tab 组窄屏换行平铺，不挤压、无需左右滑动 */
    body[class*="theme-"] .topbar-tabs { flex-wrap: wrap; row-gap: 4px; max-width: 100%; }

    /* ---------- 边缘到边缘：内容区贴合安全区，分组更紧凑 ---------- */
    body[class*="theme-"] .content-area {
        padding: 12px 12px calc(76px + env(safe-area-inset-bottom)) !important;
    }
    body[class*="theme-"] .welcome-card { padding: 18px !important; margin-bottom: 12px; }
    body[class*="theme-"] .welcome-card h2 { font-size: 19px; }
    body[class*="theme-"] .panel { padding: 14px; margin-bottom: 12px; }
    body[class*="theme-"] .stats-grid { gap: 10px; }
    body[class*="theme-"] .stat-card { padding: 14px 12px; gap: 10px; }
    body[class*="theme-"] .stat-icon { width: 40px; height: 40px; font-size: 19px; }
    body[class*="theme-"] .stat-info h3 { font-size: 20px; }

    /* ---------- 抽屉式侧栏：贴合安全区 + 更明显的进入感 ---------- */
    body[class*="theme-"] .sidebar { padding-top: env(safe-area-inset-top); box-shadow: 6px 0 28px rgba(0, 0, 0, .18); }
    body[class*="theme-"] .sidebar-footer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }

    /* ---------- 更大热区 + 按压反馈（App 的“点下去”手感） ---------- */
    body[class*="theme-"] .nav-item { padding-top: 12px; padding-bottom: 12px; }
    /* 按钮统一 44 底线：实测 38→42 仍偏低，按 iOS/Material 触控基准给到 44 */
    body[class*="theme-"] .el-button:not(.el-button--text):not(.is-link) { min-height: 44px; }
    /* 表格行内「编辑 / 删除」类小按钮：实测 36×38，是手机上误触率最高的一类 */
    body[class*="theme-"] .el-table td .el-button:not(.is-link):not(.el-button--text) {
        min-width: 44px; min-height: 44px; padding-left: 10px; padding-right: 10px;
    }
    /* 只保留图标的小按钮（窄屏把 .tb-help-tx 文字隐藏后宽度只剩 28px），补成正方形热区 */
    body[class*="theme-"] .tb-help { min-width: 44px; min-height: 44px; }
    /* 页内提示条右侧「详细说明 ›」与「×」：行内小字实测只有 16-17px 高，
       用伪元素把命中区撑到 44，但不改变提示条自身布局 */
    body[class*="theme-"] .page-hint .ph-more,
    body[class*="theme-"] .page-hint .ph-close { position: relative; }
    body[class*="theme-"] .page-hint .ph-more::after,
    body[class*="theme-"] .page-hint .ph-close::after {
        content: ''; position: absolute; left: -6px; right: -6px; top: 50%;
        transform: translateY(-50%); height: 44px;
    }
    /* 确认框：按钮与右上关闭键同样按 44 给（实测 60×42 / 40×40） */
    body[class*="theme-"] .el-message-box__btns .el-button { min-height: 44px; min-width: 72px; }
    body[class*="theme-"] .el-message-box__headerbtn {
        display: flex; align-items: center; justify-content: center;
        width: 44px; height: 44px;
    }
    /* 顶栏汉堡（admin）与菜单键（web）：实测 28×24 / 34×34，直接撑到 44×44，
       横线本身保持 22px 宽，视觉不变 */
    body.theme-admin .hamburger-btn { width: 44px; height: 44px; }
    body.theme-admin .hamburger-btn span { width: 22px; }
    body.theme-user .menu-toggle { width: 44px; height: 44px; }
    body[class*="theme-"] .el-button:active,
    body[class*="theme-"] .nav-item:active,
    body[class*="theme-"] .topbar-tab:active,
    body[class*="theme-"] .device-tab:active,
    body[class*="theme-"] .quick button:active { transform: scale(.97); }
    body[class*="theme-"] tr.el-table__row:active { background: var(--surface-3, #eef1f6); }

    /* ---------- 窄屏工具栏：搜索框独占一行、按钮两列 ---------- */
    /* admin 设备页/代理页的工具条在 380 宽下总宽 814/424，桌面一行排开就会把整个文档
       撑出横向滚动（与主题无关的旧布局缺陷）。这里改为可换行、按钮等分 */
    body[class*="theme-"] .bar-wrap { flex-wrap: wrap; }
    body[class*="theme-"] .bar-wrap > .el-input { flex: 1 1 100%; max-width: none !important; }
    body[class*="theme-"] .bar-wrap > .el-button { flex: 1 1 calc(50% - 5px); margin-left: 0 !important; }
    /* 长接口路径 / token / Base URL 在窄屏必须能断行，否则内联 code 会把页面撑宽 */
    body[class*="theme-"] code { word-break: break-all; }

    /* 主题 FAB 避开小白条 */
    .theme-toggle { bottom: calc(14px + env(safe-area-inset-bottom)); right: 14px; }
}

/* ---------- ≤560px：对话框转「底部弹层」，像原生 ActionSheet/详情页 ---------- */
@media (max-width: 560px) {
    body[class*="theme-"] .el-overlay-dialog {
        display: flex; align-items: flex-end; justify-content: center;
    }
    body[class*="theme-"] .el-dialog {
        width: 100% !important; max-width: 100vw; margin: 0 !important;
        border-radius: 16px 16px 0 0;
        max-height: 92vh; display: flex; flex-direction: column;
        padding-bottom: env(safe-area-inset-bottom);
        animation: m-sheet-up .24s var(--ease, cubic-bezier(.4, 0, .2, 1));
    }
    body[class*="theme-"] .el-dialog.is-fullscreen { border-radius: 0; max-height: 100vh; }
    body[class*="theme-"] .el-dialog__header { flex: none; }
    body[class*="theme-"] .el-dialog__body { flex: 1 1 auto; max-height: none; overflow-y: auto; }
    body[class*="theme-"] .el-dialog__footer {
        flex: none; position: sticky; bottom: 0;
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
        border-top: 1px solid var(--line, #eef0f4);
        background: var(--surface, #fff);
        justify-content: stretch;
    }
    body[class*="theme-"] .el-dialog__footer .el-button { flex: 1 1 0; margin: 0 !important; }
    @keyframes m-sheet-up { from { transform: translateY(100%); } to { transform: none; } }
    /* 消息框（确认类）保持居中，只微调贴边 */
    body[class*="theme-"] .el-message-box { width: 94% !important; }
}

/* ============================================================
   移动端底部导航栏 .mobile-tabbar（App 主界面感）
   - 各控制台在窄屏下把主要入口固定到屏幕底部（像原生 App 的 Tab Bar），
     导航栏本身由各页 Vue 模板渲染，绑定各自的 menu/currentMenu 与 openNav/openMenu/switchMenu，
     保证与侧栏同源、响应式、高亮同步；桌面 display:none 零影响。
   - z-index 取 95：低于 admin 侧栏(100)/遮罩(99)，抽屉展开时自然被盖住（原生 App 行为）。
   ============================================================ */
.mobile-tabbar { display: none; }
@media (max-width: 900px) {
    body[class*="theme-"] .mobile-tabbar {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
        height: calc(56px + env(safe-area-inset-bottom));
        padding: 0 4px env(safe-area-inset-bottom);
        background: rgba(255, 255, 255, .96);
        -webkit-backdrop-filter: none;
        backdrop-filter: none;
        border-top: 1px solid var(--line, #e8ecf1);
        box-shadow: 0 -1px 10px rgba(0, 0, 0, .04);
    }
    html.dark body[class*="theme-"] .mobile-tabbar {
        background: rgba(22, 26, 33, .96); border-top-color: #23272f; box-shadow: none;
    }
    .mobile-tabbar .m-tab {
        flex: 1 1 0; min-width: 0; height: 56px; display: flex; flex-direction: column;
        align-items: center; justify-content: center; gap: 3px; cursor: pointer;
        font-size: 12px; line-height: 1; color: var(--text-3, #8a94a6);
        -webkit-tap-highlight-color: transparent;
        transition: color .15s var(--ease), transform .12s var(--ease);
    }
    /* 图标盒固定 21×21 且 flex:none：EP .el-icon 默认 width:1em + 全局 border-box，
       若再叠胶囊 padding 会把内容宽挤成 0、svg 被 flex-shrink 压扁（图标消失的真因）。
       这里显式定宽高 + svg flex:none，保证任何 padding/胶囊都不塌缩。 */
    .mobile-tabbar .m-tab .el-icon { font-size: 21px; width: 21px; height: 21px; flex: none; }
    .mobile-tabbar .m-tab .el-icon svg { width: 100%; height: 100%; flex: none; }
    .mobile-tabbar .m-tab.on { color: var(--brand, #2563eb); font-weight: 600; }
    html.dark .mobile-tabbar .m-tab.on { color: #78abff; }
    .mobile-tabbar .m-tab:active { transform: scale(.88); }

    /* agent：手机端收起左侧栏，导航交给底部栏（抬特异度压过其内联“横向条”方案） */
    body.theme-agent .ag-side { display: none !important; }
    body.theme-agent .ag-body { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }

    /* 主题 FAB 抬到导航栏之上，避免重叠 */
    .theme-toggle { bottom: calc(66px + env(safe-area-inset-bottom)) !important; }
}

/* ============================================================
   移动端「切换/反馈」进阶 App 化（仅窄屏，桌面零影响）
   - 视图进场动画：各视图是 .content-area/.ag-body 下 <template v-if> 的直接子节点，
     切换 menu 时旧节点移除、新节点插入 → 只对直接子元素放一次淡入上移，
     数据行在深层面板内 patch 不会被触发，故无逐行闪烁。
   - 顶部提示/通知避开吸顶栏与刘海；底部弹层对话框加「抓取条」暗示可下滑。
   - 全程受 prefers-reduced-motion 约束（theme.css 已把时长归零）。
   ============================================================ */
@media (max-width: 900px) {
    body[class*="theme-"] .content-area > *,
    body[class*="theme-"] .ag-body > * {
        animation: m-view-in .28s var(--ease, cubic-bezier(.4, 0, .2, 1)) both;
    }
    @keyframes m-view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

    /* 顶部提示/通知：避开吸顶栏 + 刘海，不被顶栏盖住 */
    body[class*="theme-"] .el-message,
    body[class*="theme-"] .el-notification {
        top: calc(60px + env(safe-area-inset-top)) !important;
    }
}
@media (max-width: 560px) {
    /* 底部弹层对话框：顶部抓取条，强化「可下滑关闭」的原生暗示 */
    body[class*="theme-"] .el-dialog:not(.is-fullscreen)::before {
        content: ''; align-self: center; flex: none;
        width: 38px; height: 5px; border-radius: 3px;
        background: var(--line, #d8dde6); margin: 8px auto -2px;
    }
    html.dark body[class*="theme-"] .el-dialog:not(.is-fullscreen)::before { background: #3a3d46; }
}

/* ============================================================
   登录页 App 化（沉浸式背景，不限窄屏，登录页无副作用）
   - admin/web 登录用 body.theme-login；agent 登录在 .login-wrap。
   ============================================================ */
body.theme-login, .login-wrap {
    background: radial-gradient(680px 420px at 50% -8%, #eaf1ff 0%, #f5f7fa 60%) !important;
}
html.dark body.theme-login, html.dark .login-wrap {
    background: radial-gradient(680px 420px at 50% -8%, #14203a 0%, #0f1115 60%) !important;
}

/* ============================================================
   移动端「控件原生化 + 底部栏/抽屉细节」（仅窄屏，桌面零影响）
   ============================================================ */
@media (max-width: 900px) {
    /* ---- 触控尺寸的表单控件（接近原生输入法手感） ---- */
    body[class*="theme-"] .el-input__wrapper { min-height: 44px; padding: 5px 12px; }
    /* 下拉选择器与输入框对齐：实测 el-select__wrapper 只有 32px，同一表单里高低不齐 */
    body[class*="theme-"] .el-select__wrapper { min-height: 44px; }
    body[class*="theme-"] .el-select--small .el-select__wrapper { min-height: 44px; }
    body[class*="theme-"] .el-input--large .el-input__wrapper { min-height: 48px; }
    body[class*="theme-"] .el-input__inner,
    body[class*="theme-"] .el-textarea__inner { font-size: 16px; }   /* 16px 防 iOS 聚焦放大 */
    body[class*="theme-"] .el-input__clear,
    body[class*="theme-"] .el-input__password { font-size: 18px; width: 30px; }
    body[class*="theme-"] .el-checkbox__inner,
    body[class*="theme-"] .el-radio__inner { width: 18px; height: 18px; }
    body[class*="theme-"] .el-checkbox__label,
    body[class*="theme-"] .el-radio__label { font-size: 15px; padding-left: 8px; }
    /* 弹层里的勾选项：整行 44 高（只限弹层，不动表格表头的全选框） */
    body[class*="theme-"] .el-dialog .el-checkbox,
    body[class*="theme-"] .el-dialog .el-radio,
    body[class*="theme-"] .el-drawer .el-checkbox,
    body[class*="theme-"] .el-drawer .el-radio { min-height: 44px; }
    body[class*="theme-"] .el-input-number__decrease,
    body[class*="theme-"] .el-input-number__increase { width: 40px; }
    /* 登录页/侧栏的小文字链（如「API 测试台」）：实测热区只有 63×28，
       用内边距加负外边距把热区撑到 ~41px，行高与排版完全不变 */
    body[class*="theme-"] .login-foot a,
    body[class*="theme-"] .ag-side-foot a { display: inline-block; padding: 12px 4px; margin: -12px -4px; }
    body[class*="theme-"] .el-tag__close { width: 18px; height: 18px; }
    /* 控件宽度交由所在表单/工具栏决定，不再全局拉伸行内 select 与日期选择器 */

    /* ---- 顶栏 / 设备 tab 条：换行平铺看全，不再左右滑动 ---- */
    body[class*="theme-"] .topbar-tabs,
    body[class*="theme-"] .device-tabbar .tabs {
        flex-wrap: wrap; row-gap: 6px;
    }
    body[class*="theme-"] .device-tab { padding: 12px 14px; }

    /* ---- 抽屉在手机上：收紧头部 + 内容区避开小白条 ---- */
    body[class*="theme-"] .el-drawer__header { margin-bottom: 8px; padding: 14px 16px; }
    /* 抽屉关闭键抬到 44×44：窄屏下抽屉是全宽的，遮罩不露，这一枚就是唯一的关闭入口，
       而 EP 默认只给一个图标大小的热区 */
    body[class*="theme-"] .el-drawer__close-btn {
        display: inline-flex; align-items: center; justify-content: center;
        min-width: 44px; min-height: 44px;
    }
    body[class*="theme-"] .el-drawer__body { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }

    /* ---- 登录卡片：大热区、吸底 CTA ---- */
    body[class*="theme-"] .login-card {
        border: 0; border-radius: 18px;
        padding: 28px 22px calc(28px + env(safe-area-inset-bottom));
    }
    body[class*="theme-"] .login-title h1 { font-size: 24px; }
    body[class*="theme-"] .submit-btn { min-height: 48px; font-size: 16px; letter-spacing: 3px; border-radius: 12px; }
    /* 统一三端登录主按钮（agent 登录按钮无 .submit-btn，靠此条对齐到 48px/圆角12/16px） */
    body[class*="theme-"] .login-card .el-button--primary { min-height: 48px; border-radius: 12px; font-size: 16px; letter-spacing: 2px; }
    /* 右下角主题 FAB 与登录页底部文字/链接热区避让（长帮助块会与 FAB 重叠） */
    body[class*="theme-"] .login-help, body[class*="theme-"] .login-foot { padding-right: 46px; }

    /* ---- 底部 Tab Bar 选中项：Material 3 风格图标背后胶囊 ----
       胶囊 padding 用 content-box 加在 21×21 图标盒之外（外廓 45×27），
       所有 tab 常驻同尺寸 padding 避免选中切换跳动，仅 .on 上底色。 */
    .mobile-tabbar .m-tab .el-icon { box-sizing: content-box; padding: 3px 12px; border-radius: 15px; transition: background .18s var(--ease); }
    .mobile-tabbar .m-tab.on .el-icon { background: var(--brand-soft, #e8f0fe); }
    html.dark .mobile-tabbar .m-tab.on .el-icon { background: #123a6e; }
}

/* ============================================================
   v6 底部 Tab Bar 语义/角标/反馈/横屏（20261120j）
   - 角标 .m-badge（计数）/.m-dot（红点）锚在图标右上；不拦截点击。
   - 选中胶囊弹性 mtab-pop；键盘 focus-visible 描边；reduced-motion 关动画。
   - ≤360 多 tab（web 8 格）缩胶囊防挤爆。
   - 横屏且高<500：隐藏底部栏省纵向空间，agent 恢复内联横向导航条。
   ============================================================ */
@media (max-width: 900px) {
    .mobile-tabbar .m-tab { position: relative; }
    .mobile-tabbar .m-badge {
        position: absolute; top: 5px; left: 50%; margin-left: 9px;
        min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
        background: #ef4444; color: #fff; font-size: 10px; font-weight: 700;
        line-height: 16px; text-align: center; font-style: normal;
        box-shadow: 0 0 0 2px var(--surface, #fff); pointer-events: none;
    }
    .mobile-tabbar .m-badge.m-dot { min-width: 8px; width: 8px; height: 8px; padding: 0; margin-left: 11px; top: 7px; border-radius: 50%; }
    html.dark .mobile-tabbar .m-badge { box-shadow: 0 0 0 2px #161a21; }
    .mobile-tabbar .m-tab.on .el-icon { animation: mtab-pop .26s var(--ease); }
    .mobile-tabbar .m-tab:focus-visible { outline: 2px solid var(--brand, #2563eb); outline-offset: -2px; border-radius: 10px; }
}
@keyframes mtab-pop { 0% { transform: scale(.7); } 60% { transform: scale(1.08); } 100% { transform: scale(1); } }
@media (max-width: 360px) {
    .mobile-tabbar .m-tab { font-size: 10px; }
    .mobile-tabbar .m-tab .el-icon { font-size: 18px; width: 18px; height: 18px; padding: 3px 8px; }
}
@media (max-height: 500px) and (orientation: landscape) {
    body[class*="theme-"] .mobile-tabbar { display: none !important; }
    body.theme-agent .ag-side { display: flex !important; }
    body.theme-agent .ag-body { padding-bottom: 0 !important; }
}
@media (prefers-reduced-motion: reduce) {
    .mobile-tabbar .m-tab.on .el-icon { animation: none; }
}

/* ============================================================
   移动端「细节打磨」micro-polish（仅窄屏，桌面零影响）
   - 锚点跳转/内部滚动定位时避开吸顶栏，标题不被顶栏遮住。
   - 文本选区取品牌色，更像受控的原生 App 而非默认浏览器蓝。
   - 对话框/抽屉内滚到边界不「传染」给背景页（overscroll contain）。
   ============================================================ */
@media (max-width: 900px) {
    body[class*="theme-"] h1, body[class*="theme-"] h2,
    body[class*="theme-"] h3, body[class*="theme-"] h4,
    body[class*="theme-"] .el-card, body[class*="theme-"] [id] {
        scroll-margin-top: calc(64px + env(safe-area-inset-top));
    }
    body[class*="theme-"] ::selection {
        background: var(--brand-soft, #d3e3fd); color: var(--brand, #2563eb);
    }
    html.dark body[class*="theme-"] ::selection { background: #24406b; color: #cfe1ff; }
    body[class*="theme-"] .el-dialog__body,
    body[class*="theme-"] .el-drawer__body { overscroll-behavior: contain; }
}

/* ============================================================
   移动端「模板预览手机壳」自适应（admin 模板预览对话框）
   - 原为写死 width:395px 的手机壳 + 375×680 iframe，在 ≤560 底部弹层
     里会横向溢出。改成按容器宽缩放（iframe 用 aspect-ratio 保持比例），
     预览内容本身是响应式 H5，缩到真实手机宽度反而更贴近实机效果。
   ============================================================ */
@media (max-width: 560px) {
    body[class*="theme-"] .tpl-phone {
        width: 100%; max-width: 340px; margin: 0 auto; padding: 8px;
        border-radius: 26px; box-sizing: border-box;
    }
    body[class*="theme-"] .tpl-phone-frame {
        width: 100%; height: auto; aspect-ratio: 375 / 680; border-radius: 20px;
    }
}

/* ============================================================
   移动端精修 v2（20261120c，仅窄屏，桌面零影响）
   - 模板选择器：缩略图居中放大、极窄屏隐藏描述改双列，扫读更快；
   - 表单热区：radio-button / 下拉选项 / 开关 提到触控基准；
   - 弹出时机等行内控件在底部弹层里整行堆叠，不再挤压；
   - 步进器加减键加宽、符号加大，拇指好点。
   ============================================================ */
@media (max-width: 900px) {
    /* 分段单选（频率/强制/模式）：整块可点、高度达标 */
    body[class*="theme-"] .el-radio-button__inner {
        display: inline-flex; align-items: center; justify-content: center;
        min-height: 40px; padding: 8px 14px; font-size: 14px;
    }
    /* 下拉选项行：44 高热区，拇指不易点错 */
    body[class*="theme-"] .el-select-dropdown__item { height: 44px; line-height: 44px; font-size: 15px; }
    body[class*="theme-"] .el-select-dropdown__item.is-selected { font-weight: 700; }
    /* 开关：加大轨道与滑钮 */
    body[class*="theme-"] .el-switch { height: 28px; }
    body[class*="theme-"] .el-switch__core { height: 28px; min-height: 28px; border-radius: 14px; }
    body[class*="theme-"] .el-switch__action { width: 22px; height: 22px; top: 2px; }
    /* 步进器：加减键 44 宽、符号 18，清晰好点 */
    body[class*="theme-"] .el-input-number__decrease,
    body[class*="theme-"] .el-input-number__increase { width: 44px; }
    body[class*="theme-"] .el-input-number__decrease .el-icon,
    body[class*="theme-"] .el-input-number__increase .el-icon { font-size: 18px; }
}
@media (max-width: 560px) {
    /* 模板卡：竖版居中，缩略图放大到 120 宽（scale .32 对应 375 设计稿） */
    body[class*="theme-"] .tpl-card {
        display: flex; flex-direction: column; align-items: center; text-align: center;
        padding: 10px 8px;
    }
    body[class*="theme-"] .tpl-thumb { width: 120px; height: 213px; }
    body[class*="theme-"] .tpl-thumb-frame { transform: scale(.32); }
    body[class*="theme-"] .tpl-name { font-size: 12.5px; }
    /* 仅表单内容区的直接控件整行堆叠，卡片模块里的行内开关/选择器不被拉宽 */
    body[class*="theme-"] .el-form-item__content > .el-select,
    body[class*="theme-"] .el-form-item__content > .el-input-number { width: 100% !important; }
}
@media (max-width: 480px) {
    /* 频率等 4 选项分段：2×2 网格铺满，单块更大更好点 */
    body[class*="theme-"] .el-dialog__body .el-radio-group {
        display: grid; grid-template-columns: 1fr 1fr; gap: 6px; width: 100%;
    }
    body[class*="theme-"] .el-dialog__body .el-radio-button { width: 100%; }
    body[class*="theme-"] .el-dialog__body .el-radio-button__inner { width: 100%; border-radius: 8px !important; border-left: 1px solid var(--el-border-color, #dcdfe6); }
    /* 主流手机(≤480)：模板强制双列 + 隐藏描述，一屏看更多套；缩略图仍用 120 大档 */
    body[class*="theme-"] .tpl-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
    body[class*="theme-"] .tpl-desc { display: none; }
}
@media (max-width: 360px) {
    /* 极窄屏(≤360)：缩略图降一档保证双列不溢出 */
    body[class*="theme-"] .tpl-thumb { width: 104px; height: 185px; }
    body[class*="theme-"] .tpl-thumb-frame { transform: scale(.2773); }
}

/* ============================================================
   移动端精修 v3（20261120e）：渠道卡片左滑操作轨 + 模板预览走马灯
   ============================================================ */
/* ---- 左滑操作轨：仅 html.mob-tbl 卡片模式 + .swipe-table 命中 ----
   原理：末列(操作)绝对定位到卡片右侧外(left:100%)，其余 td 与末列一起
   平移 var(--sw)；左滑时内容左移露出操作轨。无 DOM 手术，复用既有按钮/事件。 */
@media (max-width: 900px) {
    html.mob-tbl .swipe-table:not(.table-keep) tr.el-table__row {
        position: relative; overflow: hidden; touch-action: pan-y; --sw: 0px; --railW: 132px;
    }
    html.mob-tbl .swipe-table:not(.table-keep) tr.el-table__row > td.el-table__cell {
        transform: translateX(var(--sw, 0px));
        transition: transform .24s cubic-bezier(.32, .72, .28, 1);
    }
    html.mob-tbl .swipe-table:not(.table-keep) tr.sw-drag > td.el-table__cell { transition: none; }
    html.mob-tbl .swipe-table:not(.table-keep) tr.el-table__row > td.el-table__cell:last-child {
        position: absolute !important; top: 0; bottom: 0; left: 100% !important; right: auto !important;
        width: var(--railW, 132px) !important;
        box-sizing: border-box; display: flex; align-items: center; justify-content: center;
        padding: 8px !important; background: var(--surface-3, #eef1f6);
        border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
    }
    html.mob-tbl .swipe-table:not(.table-keep) td.el-table__cell:last-child::before { content: none !important; }
    html.mob-tbl .swipe-table:not(.table-keep) td.el-table__cell:last-child .cell {
        display: flex; flex-direction: column; gap: 8px; width: 100%; justify-content: center; padding: 0 !important;
    }
    html.mob-tbl .swipe-table.rail-2col:not(.table-keep) td.el-table__cell:last-child .cell {
        display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
    }
    html.mob-tbl .swipe-table:not(.table-keep) td.el-table__cell:last-child .el-button {
        width: 100%; margin: 0 !important; min-height: 38px; border-radius: 9px;
        color: #fff !important; font-size: 12.5px; font-weight: 600;
    }
    html.mob-tbl .swipe-table:not(.table-keep) td:last-child .el-button--success { background: #2563eb !important; }
    html.mob-tbl .swipe-table:not(.table-keep) td:last-child .el-button--primary { background: #3b82f6 !important; }
    html.mob-tbl .swipe-table:not(.table-keep) td:last-child .el-button--danger { background: #ef4444 !important; }
    html.mob-tbl .swipe-table:not(.table-keep) td:last-child .el-button--warning { background: #f59e0b !important; }
    html.mob-tbl .swipe-table:not(.table-keep) td:last-child .el-button:not(.el-button--success):not(.el-button--primary):not(.el-button--danger):not(.el-button--warning) { background: #64748b !important; }
    html.mob-tbl .swipe-table:not(.table-keep) td:last-child .el-button.is-disabled { opacity: .45; }
    /* 末列变操作轨后，卡片底边/圆角改由倒数第二列收口 */
    html.mob-tbl .swipe-table:not(.table-keep) tr.el-table__row > td.el-table__cell:nth-last-child(2) {
        border-bottom-width: 1px !important; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px;
    }
}
/* ---- 模板预览走马灯（admin/agent 共用，不限窄屏） ---- */
.tpl-phone { width: min(395px, 100%); margin: 0 auto; padding: 10px; background: #111827; border-radius: 34px; box-sizing: border-box; }
.tpl-phone-frame { width: 100%; height: auto; aspect-ratio: 375 / 680; border: none; border-radius: 26px; background: #fff; display: block; }
.tpl-carousel { position: relative; display: flex; align-items: center; justify-content: center; gap: 6px; touch-action: pan-y; }
.tpl-carousel .tpl-phone { flex: 0 1 auto; min-width: 0; }
.tpl-nav {
    flex: 0 0 auto; width: 38px; height: 38px; border-radius: 50%;
    border: 1px solid var(--line, #e5e7eb); background: var(--surface, #fff);
    color: var(--text-2, #606266); display: flex; align-items: center; justify-content: center;
    cursor: pointer; font-size: 18px; line-height: 1; transition: .15s; user-select: none;
}
.tpl-nav:hover { color: #2563eb; border-color: #2563eb; }
.tpl-nav:disabled { opacity: .3; cursor: default; }
.tpl-dots { display: flex; gap: 6px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.tpl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line, #d8dde6); cursor: pointer; transition: .15s; }
.tpl-dot.on { background: #2563eb; transform: scale(1.3); }
.tpl-count { text-align: center; font-size: 12px; color: var(--text-3, #8a94a6); margin-top: 6px; }
.tpl-swipe-hint { text-align: center; font-size: 11px; color: var(--text-3, #9aa4b2); margin-top: 4px; }
@media (max-width: 560px) {
    .tpl-nav { width: 32px; height: 32px; font-size: 16px; }
}

/* ============================================================
   移动端精修 v4（20261120h）：左滑可发现性 + 走马灯平滑滑动轨道
   ============================================================ */
/* 卡片右缘品牌色抓手：暗示「可左滑」 */
@media (max-width: 900px) {
    html.mob-tbl .swipe-table:not(.table-keep) tr.el-table__row::after {
        content: ''; position: absolute; top: 0; bottom: 0; right: 0; width: 4px;
        background: linear-gradient(90deg, transparent, rgba(37, 99, 235, .4));
        pointer-events: none;
    }
}
/* 列表顶部一次性操作提示（仅手机显示） */
.swipe-tip {
    align-items: center; gap: 6px; margin: 0 0 10px; padding: 7px 12px;
    border-radius: 10px; background: var(--brand-soft, #e8f0fe);
    color: var(--brand, #2563eb); font-size: 12.5px; font-weight: 600;
}
html.dark .swipe-tip { background: #123a6e; color: #78abff; }
/* 走马灯滑动轨道：所有-slide 预挂载，切换只平移不重载 iframe（无白闪） */
.tpl-viewport { overflow: hidden; flex: 0 1 auto; min-width: 0; width: 100%; max-width: 415px; }
.tpl-viewport.grab { cursor: grab; }
.tpl-viewport.grab:active { cursor: grabbing; }
.tpl-track { display: flex; width: 100%; transition: transform .32s cubic-bezier(.32, .72, .28, 1); will-change: transform; }
.tpl-slide { flex: 0 0 100%; min-width: 0; display: flex; justify-content: center; }
.tpl-slide .tpl-phone { width: 100%; max-width: 395px; }
@media (prefers-reduced-motion: reduce) { .tpl-track { transition: none; } }

/* ============================================================
   统一注入管理 / 创建引导 / 网页转 APP（admin + agent）
   ============================================================ */
.im-hero {
    position: relative; overflow: hidden; margin-bottom: 14px; padding: 20px 22px 18px;
    border-radius: 18px; color: #fff;
    background: linear-gradient(120deg, #1e3a8a 0%, #1d4ed8 42%, #2563eb 72%, #3b82f6 100%);
    box-shadow: 0 10px 30px rgba(37, 99, 235, .16);
}
.im-hero::before {
    content: ''; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(420px 180px at 90% -30%, rgba(255,255,255,.3), transparent 70%),
                radial-gradient(320px 160px at 4% 130%, rgba(56,189,248,.32), transparent 70%);
}
.im-hero-top { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.im-hero-copy { min-width: 0; }
.im-hero-title { font-size: 20px; font-weight: 800; letter-spacing: .3px; }
.im-hero-sub { margin-top: 5px; font-size: 13px; line-height: 1.7; opacity: .9; max-width: 720px; }
.im-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: none; }
.im-add-split { display: inline-flex; align-items: stretch; vertical-align: middle; min-width: 0; max-width: 100%; }
.im-add-split > .el-button:first-child {
    flex: 1 1 auto; min-width: 0; white-space: nowrap;
    border-top-right-radius: 0; border-bottom-right-radius: 0;
}
/* el-dropdown 会包一层 tooltip trigger，第二个按钮不是 .im-add-split 的直接子元素；
   必须同时约束包裹层和后代按钮，否则箭头键会变成独立圆角块，窄屏下图标盒还可能被压空。 */
.im-add-split > .el-dropdown {
    display: flex; flex: 0 0 36px; width: 36px; min-width: 36px; max-width: 36px; margin-left: -1px;
}
.im-add-split > .el-dropdown .el-button {
    flex: 0 0 36px; width: 36px; min-width: 36px; padding-left: 0; padding-right: 0;
    border-top-left-radius: 0; border-bottom-left-radius: 0;
}
.im-add-split > .el-dropdown .el-button .el-icon { display: inline-flex; width: 16px; height: 16px; flex: none; font-size: 16px; }
.im-add-split > .el-dropdown .el-button .el-icon svg { width: 100%; height: 100%; flex: none; }
.im-hero .im-add-split .el-button--primary { background: #fff; border-color: #fff; color: #1d4ed8; }
.im-hero .im-add-split .el-button--primary:hover { background: #eff6ff; }
.im-hero .im-web-btn { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.42); color: #fff; }
.im-hero .im-web-btn:hover { background: rgba(255,255,255,.24); border-color: rgba(255,255,255,.7); }
.im-kpis { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; margin-top: 16px; }
.im-kpi { padding: 10px 12px; border: 1px solid rgba(255,255,255,.22); border-radius: 12px; background: rgba(255,255,255,.13); }
.im-kpi .k { font-size: 11.5px; opacity: .84; white-space: nowrap; }
.im-kpi .v { margin-top: 2px; font-size: 21px; font-weight: 800; line-height: 1.15; }
.im-kpi .v small { font-size: 11px; font-weight: 400; opacity: .8; }
.im-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.im-toolbar .sp { flex: 1; }
.im-toolbar .el-input { width: 220px; }
.im-count { color: var(--text-3, #8a94a6); font-size: 12px; white-space: nowrap; }
.im-bulk { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--brand, #2563eb); border-radius: 12px; background: var(--brand-soft, #e8f1fe); }
.im-bulk .tx { color: var(--brand, #2563eb); font-size: 12.5px; font-weight: 600; }
.im-view-switch { display: inline-flex; padding: 3px; border-radius: 9px; background: var(--surface-2, #f3f4f6); }
.im-view-switch button { border: 0; background: transparent; color: var(--text-2, #697487); border-radius: 7px; padding: 5px 10px; font-size: 12px; cursor: pointer; }
.im-view-switch button.on { background: var(--surface, #fff); color: var(--brand, #2563eb); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.im-guide { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--line, #e6e9ef); border-radius: 11px; background: var(--surface-2, #f8fafc); color: var(--text-2, #697487); font-size: 12px; line-height: 1.65; }
.im-guide b { color: var(--text-1, #1f2430); }
.im-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.im-card { position: relative; min-width: 0; padding: 15px 16px 12px; border: 1px solid var(--line, #e6e9ef); border-radius: 15px; background: var(--surface, #fff); transition: border-color .18s, box-shadow .18s, transform .18s; }
.im-card:hover { border-color: #9dc0f8; box-shadow: 0 7px 24px rgba(37,99,235,.12); transform: translateY(-2px); }
.im-card.sel { border-color: var(--brand, #2563eb); box-shadow: 0 0 0 2px rgba(37,99,235,.16); }
.im-card-check { position: absolute; top: 12px; right: 12px; z-index: 2; }
.im-card-head { display: flex; align-items: center; gap: 11px; padding-right: 25px; min-width: 0; }
.im-card-icon { width: 46px; height: 46px; flex: none; border-radius: 12px; object-fit: cover; background: #fff; box-shadow: 0 1px 5px rgba(0,0,0,.13); }
.im-card-ph { width: 46px; height: 46px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 12px; color: #fff; font-size: 19px; font-weight: 800; background: linear-gradient(135deg, #2563eb, #60a5fa); }
.im-card-main { flex: 1; min-width: 0; }
.im-card-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-1, #1f2430); font-size: 15px; font-weight: 700; }
.im-card-meta { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-3, #8a94a6); font-size: 11px; }
.im-card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.im-card-owner { display: flex; align-items: center; gap: 6px; margin-top: 8px; color: var(--text-3, #8a94a6); font-size: 11.5px; }
.im-card-owner b { color: var(--text-2, #697487); font-weight: 600; }
.im-card-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 6px; margin: 11px 0; }
.im-card-stat { padding: 7px 4px; text-align: center; border: 1px solid var(--line, #e6e9ef); border-radius: 10px; background: var(--surface-2, #f8fafc); }
.im-card-stat .k { color: var(--text-3, #8a94a6); font-size: 10.5px; white-space: nowrap; }
.im-card-stat .v { margin-top: 2px; color: var(--text-1, #1f2430); font-size: 15px; font-weight: 800; }
.im-card-stat .v.on { color: #16a34a; }
.im-dot { display: inline-block; width: 7px; height: 7px; margin-right: 4px; border-radius: 50%; background: #16a34a; vertical-align: 1px; animation: im-pulse 1.8s ease-out infinite; }
@keyframes im-pulse { 0% { box-shadow: 0 0 0 0 rgba(22,163,74,.45); } 70% { box-shadow: 0 0 0 6px rgba(22,163,74,0); } 100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); } }
.im-card-progress { margin: 2px 0 10px; }
.im-card-progress .tx { margin-top: 4px; color: #b7791f; font-size: 11.5px; }
.im-card-mods { margin-top: 2px; padding-top: 9px; border-top: 1px dashed var(--line, #e6e9ef); }
.im-card-mods-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; color: var(--text-3, #8a94a6); font-size: 11px; font-weight: 700; letter-spacing: .6px; }
.im-card-mods-title .sub { font-weight: 400; letter-spacing: 0; }
.im-card-mod { display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 4px 0; }
.im-card-mod .lb { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; color: var(--text-1, #1f2430); font-size: 13px; }
.im-card-mod .sub { color: var(--text-3, #8a94a6); font-size: 11px; font-weight: 400; }
.im-card-mod > .el-select, .im-card-mod > .el-switch { flex: none; }
.im-card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-top: 9px; padding-top: 7px; border-top: 1px solid var(--line, #e6e9ef); }
.im-card-foot .el-button { padding: 4px 7px; }
.im-empty { padding: 42px 14px; text-align: center; color: var(--text-3, #8a94a6); font-size: 13px; line-height: 1.9; }
.im-empty-title { color: var(--text-1, #1f2430); font-size: 16px; font-weight: 700; }
.im-load-error { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 12px; margin-bottom: 12px; padding: 13px 15px; border: 1px solid var(--el-color-danger-light-7, #fbc4c4); border-radius: 12px; background: var(--el-color-danger-light-9, #fef0f0); color: var(--el-color-danger, #f56c6c); font-size: 13px; line-height: 1.6; }
.im-load-error .err-tx { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.im-load-error .el-button { flex: none; margin-left: 0; }
.im-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 4px 0 14px; }
.im-mode-card { display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px; text-align: left; border: 1.5px solid var(--line, #e6e9ef); border-radius: 12px; background: var(--surface, #fff); color: var(--text-1, #1f2430); cursor: pointer; transition: .16s; }
.im-mode-card:hover { border-color: #9dc0f8; }
.im-mode-card.on { border-color: var(--brand, #2563eb); background: var(--brand-soft, #e8f1fe); box-shadow: 0 0 0 2px rgba(37,99,235,.12) inset; }
.im-mode-ic { width: 34px; height: 34px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 10px; background: var(--surface-2, #f3f4f6); color: var(--brand, #2563eb); font-size: 18px; }
.im-mode-card b { display: block; font-size: 13.5px; }
.im-mode-card i { display: block; margin-top: 3px; color: var(--text-3, #8a94a6); font-size: 11.5px; font-style: normal; line-height: 1.55; }
.im-quick { padding: 2px 0 4px; }
.im-quick-section { margin-bottom: 14px; }
.im-quick-title { margin-bottom: 8px; color: var(--text-1, #1f2430); font-size: 13px; font-weight: 700; }
.im-quick-title span { margin-left: 4px; color: var(--text-3, #8a94a6); font-size: 11.5px; font-weight: 400; }
.im-quick-apps { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; max-height: 244px; overflow: auto; }
.im-quick-app { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px; text-align: left; border: 1px solid var(--line, #e6e9ef); border-radius: 11px; background: var(--surface, #fff); cursor: pointer; }
.im-quick-app:hover, .im-quick-app.on { border-color: var(--brand, #2563eb); background: var(--brand-soft, #e8f1fe); }
.im-quick-app img, .im-quick-app .ph { width: 34px; height: 34px; flex: none; border-radius: 9px; object-fit: cover; background: var(--surface-2, #f3f4f6); }
.im-quick-app .ph { display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.im-quick-app .tx { min-width: 0; }
.im-quick-app b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.im-quick-app i { display: block; margin-top: 2px; color: var(--text-3, #8a94a6); font-size: 10.5px; font-style: normal; }
.im-quick-app .check { position: absolute; top: 4px; right: 5px; color: var(--brand, #2563eb); font-size: 12px; font-weight: 800; }
.im-quick-alt { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 9px; }
.im-quick-picked { display: flex; align-items: center; gap: 10px; margin-top: 9px; padding: 10px 12px; border: 1px solid var(--line, #e6e9ef); border-radius: 11px; background: var(--surface-2, #f8fafc); }
.im-quick-picked img, .im-quick-picked .ph { width: 40px; height: 40px; flex: none; border-radius: 10px; object-fit: cover; background: #fff; }
.im-quick-picked .ph { display: flex; align-items: center; justify-content: center; color: var(--text-3); }
.im-quick-picked .tx { flex: 1; min-width: 0; }
.im-quick-picked b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.im-quick-picked span { display: block; margin-top: 2px; color: var(--text-3, #8a94a6); font-size: 11.5px; }
.im-auto-box { padding: 11px 13px; border: 1px solid var(--line, #e6e9ef); border-radius: 11px; background: var(--surface-2, #f8fafc); color: var(--text-2, #697487); font-size: 12px; line-height: 1.75; }
.im-auto-box b { color: var(--text-1, #1f2430); }
.im-quick-setting { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 12px; padding: 10px 12px; border: 1px dashed var(--line, #e6e9ef); border-radius: 11px; }
.im-quick-setting .lb { margin-right: 4px; color: var(--text-1, #1f2430); font-size: 12.5px; font-weight: 600; }
.im-quick-setting .tip { width: 100%; color: var(--text-3, #8a94a6); font-size: 11.5px; line-height: 1.6; }
.im-web-intro { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; padding: 13px 14px; border: 1px solid var(--line, #e6e9ef); border-radius: 12px; background: var(--surface-2, #f8fafc); }
.im-web-intro .ic { width: 40px; height: 40px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: 11px; background: var(--brand-soft, #e8f1fe); color: var(--brand, #2563eb); font-size: 20px; }
.im-web-intro b { display: block; color: var(--text-1, #1f2430); font-size: 13.5px; }
.im-web-intro span { display: block; margin-top: 3px; color: var(--text-3, #8a94a6); font-size: 12px; line-height: 1.65; }
.im-web-result { padding: 16px; text-align: center; border: 1px solid var(--line, #e6e9ef); border-radius: 13px; background: var(--surface-2, #f8fafc); }
.im-web-result h3 { margin-bottom: 5px; color: var(--text-1, #1f2430); font-size: 17px; }
.im-web-result p { color: var(--text-3, #8a94a6); font-size: 12px; line-height: 1.7; }
.im-web-link { display: flex; align-items: center; gap: 8px; margin: 12px 0; padding: 9px 11px; border: 1px solid var(--line, #e6e9ef); border-radius: 9px; background: var(--surface, #fff); }
.im-web-link code { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--brand, #2563eb); font-size: 11.5px; text-align: left; }
.im-web-advanced { margin-top: 12px; overflow: hidden; border: 1px solid var(--line, #e6e9ef); border-radius: 11px; background: var(--surface, #fff); }
.im-web-advanced summary { padding: 11px 13px; color: var(--text-2, #697487); font-size: 12.5px; font-weight: 600; cursor: pointer; user-select: none; }
.im-web-advanced summary:hover { color: var(--brand, #2563eb); background: var(--surface-2, #f8fafc); }
.im-web-advanced-body { padding: 2px 14px 0; border-top: 1px solid var(--line, #e6e9ef); }

/* 表单标签保持单行：Element Plus 的 label 是 inline-flex，宽度不足时中文会逐字换行，
   在固定行高下表现为只剩末字或与上一行重叠。标签宽度仍在各表单按最长文案设置。 */
body[class*="theme-"] .el-form-item { max-width: 100%; }
body[class*="theme-"] .el-form-item__content { min-width: 0; }
body[class*="theme-"] .el-form-item__label { white-space: nowrap; }
body[class*="theme-"] .el-form-item__label .el-tooltip { flex: none; }
/* 桌面窄弹窗里的并列表单也要允许换行，不能等手机断点才处理。 */
.el-dialog__body .el-form > [style*="display:flex"],
.el-dialog__body .el-form > [style*="display: flex"] { flex-wrap: wrap; }
.el-dialog__body .el-form > [style*="display:flex"] > .el-form-item,
.el-dialog__body .el-form > [style*="display: flex"] > .el-form-item { min-width: 0; }
.im-form-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; min-width: 0; }
.im-form-row > .el-form-item { min-width: 0; }
.im-form-row > .el-form-item:first-child { flex: 1 1 240px; }
.im-form-row > .el-form-item:last-child { flex: 0 0 auto; }
.im-number-unit { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px; flex: 0 0 auto; max-width: 100%; }
.im-number-unit .el-input-number { flex: none; }
.im-number-unit > span { white-space: nowrap; }
@media (max-width: 480px) {
    .im-form-row { flex-direction: column; }
    .im-form-row > .el-form-item { width: 100%; flex: 0 0 auto; }
}
@media (max-width: 900px) {
    .im-hero-top { flex-direction: column; }
    .im-actions { width: 100%; }
    .im-kpis { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .im-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
    .im-hero { padding: 17px 16px 15px; border-radius: 15px; }
    .im-hero-title { font-size: 18px; }
    .im-actions .el-button { flex: 1 1 auto; }
    .im-add-split { flex: 1 1 auto; }
    .im-add-split > .el-button:first-child { flex: 1; }
    .im-toolbar .el-input, .im-toolbar .el-select { width: 100% !important; }
    .im-toolbar .sp { display: none; }
    .im-toolbar > .el-button { flex: 1 1 auto; }
    .im-bulk > .el-button { flex: 1 1 auto; }
    .im-mode-switch { grid-template-columns: 1fr; }
    .im-quick-apps { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .im-card-stats { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 4px; }
    .im-card { padding: 13px 13px 10px; }
    .im-card-mod { align-items: flex-start; }
    .im-card-mod > .el-select { width: 132px; }
    .im-load-error { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { .im-card, .im-card:hover { transition: none; transform: none; } .im-dot { animation: none; } }
