/* ═══════════════════════════════════════════════════════════════
   mobile.css — Stock Data Hub 手机端适配
   所有页面共享的手机端响应式样式
   
   策略：PC端优先，手机端通过 max-width 媒体查询覆盖
   断点：768px（平板竖屏及手机）
   ═══════════════════════════════════════════════════════════════ */

/* ── 手机端全局 ─────────────────────────── */
@media (max-width: 768px) {
    /* 基础布局 */
    .main {
        max-width: 100%;
        margin: 0;
        padding: 0.75rem;
    }

    /* 页面标题 */
    .page-title {
        font-size: 1.3rem;
    }
    .page-desc {
        font-size: 0.82rem;
        margin-bottom: 1rem;
    }
    .page-header {
        margin-bottom: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .page-time {
        font-size: 0.75rem;
    }

    /* ── 卡片 ── */
    .card,
    .section-card {
        border-radius: 12px;
        padding: 1rem 1rem;
        margin-bottom: 0.75rem;
    }
    .card-title {
        font-size: 0.95rem;
        margin-bottom: 1rem;
    }

    /* ── 筛选栏 ── */
    .filter-bar {
        flex-direction: column;
        gap: 0.75rem;
    }
    .filter-group {
        width: 100%;
    }
    .filter-input,
    .filter-select {
        width: 100%;
        min-width: 0;
        font-size: 0.85rem;
        padding: 0.55rem 0.75rem;
    }
    .filter-label {
        font-size: 0.72rem;
    }

    /* ── 按钮 ── */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.82rem;
        border-radius: 8px;
    }
    .btn-sm {
        padding: 0.3rem 0.6rem;
        font-size: 0.72rem;
    }

    /* ── 统计卡片网格 ── */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem;
    }
    .stat-mini {
        padding: 0.55rem 0.4rem;
        border-radius: 10px;
    }
    .stat-mini .stat-icon {
        font-size: 1rem;
        margin-bottom: 0.15rem;
    }
    .stat-mini .stat-val {
        font-size: 1.05rem;
    }
    .stat-mini .stat-lbl {
        font-size: 0.62rem;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    .stat-card {
        padding: 0.75rem;
        border-radius: 10px;
    }
    .stat-value {
        font-size: 1.2rem;
    }
    .stat-label {
        font-size: 0.7rem;
    }

    /* ── 图表 ── */
    .chart-wrapper {
        height: 220px;
        overflow: hidden;
    }

    /* ── 表格 ── */
    .table-wrapper {
        border-radius: 10px;
        max-height: 400px;
    }
    table {
        font-size: 0.75rem;
    }
    thead th {
        padding: 0.5rem 0.5rem;
        font-size: 0.65rem;
    }
    tbody td {
        padding: 0.45rem 0.5rem;
        font-size: 0.75rem;
    }

    /* 实时股价表格手机端精简 */
    .quote-table {
        font-size: 0.78rem;
    }
    .quote-table th,
    .quote-table td {
        padding: 0.5rem 0.4rem;
    }
    .quote-table .stock-name {
        font-size: 0.85rem;
    }
    .quote-table .price-cell {
        font-size: 0.9rem;
    }
    .quote-table .change-badge {
        padding: 0.15rem 0.4rem;
        font-size: 0.75rem;
    }

    /* ── 任务列表 ── */
    .task-mini-item {
        padding: 0.45rem 0.55rem;
        border-radius: 8px;
        flex-wrap: nowrap;
        gap: 0.35rem;
    }
    .task-mini-left {
        gap: 0.3rem;
        flex-wrap: nowrap;
        overflow: hidden;
        min-width: 0;
    }
    .task-mini-name {
        font-size: 0.78rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .task-mini-meta {
        font-size: 0.68rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* ── 最近执行 ── */
    .log-mini-item {
        padding: 0.4rem 0.5rem;
        border-radius: 6px;
        font-size: 0.75rem;
    }

    /* ── 两栏变单栏 ── */
    .two-col {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* ── 表单 ── */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .form-input,
    .form-select {
        font-size: 0.85rem;
        padding: 0.55rem 0.75rem;
    }

    /* ── Modal ── */
    .modal {
        border-radius: 12px;
        padding: 1.25rem;
        width: 95%;
        max-height: 85vh;
    }
    .modal-wide {
        max-width: 100%;
    }
    .modal-title {
        font-size: 1rem;
    }
    .modal-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    .modal-actions .btn {
        width: 100%;
        justify-content: center;
    }

    /* ── 时段区块 ── */
    .time-period-row {
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .time-period-row .form-input {
        width: 100px;
    }

    /* ── 任务项 ── */
    .task-item {
        padding: 0.75rem;
        border-radius: 10px;
    }
    .task-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .task-name {
        font-size: 0.9rem;
    }
    .task-meta {
        gap: 0.75rem;
        font-size: 0.78rem;
    }

    /* ── 分页 ── */
    .pagination {
        gap: 0.25rem;
    }
    .pagination .btn {
        min-width: 30px;
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }
    .pagination .page-info {
        font-size: 0.75rem;
    }

    /* ── Toast ── */
    .toast-container {
        top: auto;
        bottom: 80px;
        right: 0.75rem;
        left: 0.75rem;
    }
    .toast {
        max-width: 100%;
        font-size: 0.82rem;
        padding: 0.7rem 1rem;
    }

    /* ── 空状态 ── */
    .empty-state {
        padding: 2rem 1rem;
    }
    .empty-state .icon {
        font-size: 2.5rem;
    }

    /* ── Badge ── */
    .badge {
        font-size: 0.65rem;
        padding: 0.12rem 0.45rem;
    }

    /* ── HV 切换按钮 ── */
    .btn-hv-toggle {
        padding: 0.3rem 0.7rem;
        font-size: 0.75rem;
    }

    /* ── 类型选择药丸 ── */
    .type-pills {
        flex-wrap: wrap;
    }
    .type-pill {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }

    /* ── 详情按钮 ── */
    .btn-detail {
        padding: 0.25rem 0.55rem;
        font-size: 0.72rem;
    }

    /* ── section header ── */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .section-filters {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .section-filters .filter-select,
    .section-filters .filter-input {
        flex: 1;
        min-width: 120px;
        font-size: 0.82rem;
    }

    /* ── Quick tags ── */
    .quick-tags {
        gap: 0.3rem;
    }
    .quick-tag {
        font-size: 0.68rem;
        padding: 0.15rem 0.5rem;
    }

    /* ── Toggle 开关 ── */
    .toggle {
        width: 38px;
        height: 22px;
    }
    .toggle-slider::before {
        width: 16px;
        height: 16px;
    }
    .toggle input:checked + .toggle-slider::before {
        transform: translateX(16px);
    }

    /* ── 期权 tag ── */
    .tag-call, .tag-put {
        font-size: 0.68rem;
        padding: 0.1rem 0.4rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Phase 1: 基础框架层 — 内联 grid 覆盖 & 触摸友好 & 通用组件
   
   断点体系：
     ≤375px  — 超小手机（iPhone SE）
     ≤768px  — 手机竖屏（主断点）
     ≤960px  — 平板竖屏 / 大手机横屏
     ≤1200px — 平板横屏 / 小笔记本
   ═══════════════════════════════════════════════════════════════ */

/* ── 平板断点 (≤960px) ── */
@media (max-width: 960px) {
    /* 4列 grid 降为 2列 */
    [style*="grid-template-columns:repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    [style*="grid-template-columns:1fr 1fr 1fr 1fr"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* 6列统计行降为 3列 */
    [style*="grid-template-columns:repeat(6"] {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .stat-row[style*="grid-template-columns:repeat(6"] {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* ── 手机端主断点 (≤768px) ── */
@media (max-width: 768px) {

    /* ─── 核心：强制覆盖内联 grid 为单列 ─── */
    [style*="grid-template-columns:1fr 1fr;"],
    [style*="grid-template-columns:1fr 1fr 1fr 1fr;"],
    [style*="grid-template-columns: 1fr 1fr;"],
    [style*="grid-template-columns:1fr 1fr;gap"],
    [style*="grid-template-columns:1fr 1fr;align"] {
        grid-template-columns: 1fr !important;
    }

    /* 4列 grid 降为单列 */
    [style*="grid-template-columns:repeat(4"] {
        grid-template-columns: 1fr !important;
    }

    /* 6列统计行降为 2列 */
    [style*="grid-template-columns:repeat(6"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .stat-row[style*="grid-template-columns:repeat(6"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* auto-fit/auto-fill 的 grid 保持自适应，但缩小 minmax */
    [style*="grid-template-columns:repeat(auto-fit"],
    [style*="grid-template-columns:repeat(auto-fill"] {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)) !important;
    }

    /* 特殊：期权链 grid 行（3fr + 6x1fr）降为更紧凑布局 */
    [style*="grid-template-columns:3fr repeat(6"] {
        grid-template-columns: 2fr repeat(3, 1fr) !important;
        font-size: 0.72rem !important;
    }

    /* ─── 触摸友好：最小 44px 触摸区域 ─── */
    .btn, button, a.seg-sub__item,
    .mobile-drawer__item, .mobile-tabbar__item {
        min-height: 44px;
    }
    /* 输入框触摸区域 + 防 iOS 自动缩放 */
    .form-input, .form-select,
    input[type="text"], input[type="number"], input[type="date"],
    input[type="password"], input[type="email"],
    select, textarea {
        min-height: 44px;
        font-size: 16px; /* ≥16px 防止 iOS Safari 自动缩放 */
    }

    /* ─── Modal 手机端全屏化 ─── */
    .modal {
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        margin: 0;
        position: fixed;
        top: 0;
        left: 0;
    }
    .modal-overlay.show {
        align-items: stretch;
    }
    .modal-wide {
        max-width: 100% !important;
    }
    /* Modal 内容区滚动 */
    .modal-body,
    .modal > *:not(.modal-title):not(.modal-actions) {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* Modal 底部按钮固定 */
    .modal-actions {
        position: sticky;
        bottom: 0;
        background: var(--bg-card);
        padding: 1rem 0 calc(1rem + env(safe-area-inset-bottom, 0));
        margin: 0 -1.25rem -1.25rem;
        padding-left: 1.25rem;
        padding-right: 1.25rem;
        border-top: 1px solid var(--border);
        z-index: 10;
    }

    /* ─── 表格响应式基础框架 ─── */
    /* 策略1: 列隐藏 — 通过 data 属性标记 */
    [data-mobile-hide] {
        display: none !important;
    }
    th[data-mobile-hide],
    td[data-mobile-hide] {
        display: none !important;
    }

    /* 策略2: 卡片化 — 给表格加 .table-card-mobile 类 */
    .table-card-mobile thead {
        display: none;
    }
    .table-card-mobile tbody tr {
        display: block;
        padding: 0.75rem;
        border: 1px solid var(--border);
        border-radius: 10px;
        margin-bottom: 0.5rem;
        background: var(--bg-card);
    }
    .table-card-mobile tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.3rem 0;
        border: none;
        border-bottom: 1px solid rgba(30,58,95,0.2);
        font-size: 0.8rem;
    }
    .table-card-mobile tbody td:last-child {
        border-bottom: none;
    }
    .table-card-mobile tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.72rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        flex-shrink: 0;
        margin-right: 0.75rem;
    }

    /* ─── 底部安全区扩展 ─── */
    /* 页面底部留出 tabbar + 安全区空间 */
    .main {
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0));
    }

    /* ─── 图表自适应 ─── */
    .chart-wrapper {
        min-height: 180px;
        max-height: 280px;
        overflow: hidden;
    }
    .chart-container {
        min-height: 180px;
        max-height: 280px;
        overflow: hidden;
    }

    /* ─── 间距缩减 ─── */
    [style*="gap:1.5rem"] {
        gap: 0.75rem !important;
    }
    [style*="gap:1.2rem"] {
        gap: 0.6rem !important;
    }
    [style*="gap:1rem;"] {
        gap: 0.5rem !important;
    }
}

/* ── 超小屏幕 (≤375px) ── */
@media (max-width: 375px) {
    .main {
        padding: 0.5rem;
        padding-bottom: calc(70px + env(safe-area-inset-bottom, 0));
    }
    .page-title {
        font-size: 1.15rem;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.35rem;
    }
    .stat-mini .stat-val {
        font-size: 0.9rem;
    }
    .stat-mini .stat-icon {
        font-size: 0.85rem;
        margin-bottom: 0.1rem;
    }
    .stat-mini {
        padding: 0.45rem 0.35rem;
    }
    .stat-mini .stat-lbl {
        font-size: 0.58rem;
    }
    .chart-wrapper {
        height: 180px;
        overflow: hidden;
    }
    .card,
    .section-card {
        padding: 0.75rem;
        border-radius: 10px;
    }

    /* 超小屏 auto-fit grid 进一步缩小 */
    [style*="grid-template-columns:repeat(auto-fit"],
    [style*="grid-template-columns:repeat(auto-fill"] {
        grid-template-columns: 1fr !important;
    }

    /* 超小屏统计行降为单列 */
    [style*="grid-template-columns:repeat(6"] {
        grid-template-columns: 1fr !important;
    }
    .stat-row[style*="grid-template-columns:repeat(6"] {
        grid-template-columns: 1fr !important;
    }

    /* 超小屏 Modal 内边距缩小 */
    .modal {
        padding: 0.75rem;
    }
    .modal-actions {
        margin: 0 -0.75rem -0.75rem;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}


/* ═══════════════════════════════════════════════════════════════
   Phase 2: 通用组件响应式优化
   
   覆盖所有页面共享的 UI 组件：
   Tab 栏、筛选栏、配置表单、统计行、数据表格、
   操作按钮组、图表容器、内联 flex 布局等
   ═══════════════════════════════════════════════════════════════ */

/* ── 平板断点 (≤960px) ── */
@media (max-width: 960px) {
    /* Tab 栏：平板端缩小间距 */
    .tab-bar {
        gap: 0;
    }
    .tab-item {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    /* 统计行：平板端 3 列 */
    .stat-row {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    /* 筛选栏：平板端换行 */
    .filter-bar {
        flex-wrap: wrap;
    }
    .filter-bar select,
    .filter-bar input {
        min-width: 0;
        flex: 1;
    }
}

/* ── 手机端主断点 (≤768px) ── */
@media (max-width: 768px) {

    /* ─── Tab 栏：横向滚动 + 紧凑化 ─── */
    .tab-bar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 0;
        padding: 3px;
        margin-bottom: 1rem;
    }
    .tab-bar::-webkit-scrollbar {
        display: none;
    }
    .tab-item {
        padding: 0.5rem 0.85rem;
        font-size: 0.78rem;
        white-space: nowrap;
        flex-shrink: 0;
        border-radius: 8px;
    }
    /* Tab 内容区 */
    .tab-content {
        min-height: 200px;
    }

    /* ─── 筛选栏：全宽纵向排列 ─── */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        padding: 0.75rem 1rem;
        border-radius: 10px;
        margin-bottom: 1rem;
    }
    .filter-bar label {
        font-size: 0.75rem;
    }
    .filter-bar select,
    .filter-bar input {
        width: 100%;
        min-width: 0 !important;
        font-size: 16px; /* 防 iOS 缩放 */
    }
    .filter-bar .btn {
        width: 100%;
        justify-content: center;
    }

    /* ─── 配置表单：单列化 ─── */
    .config-panel {
        padding: 1rem;
        border-radius: 12px;
        margin-bottom: 1rem;
    }
    .config-title {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }
    .config-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }

    /* ─── 统计行：2 列 ─── */
    .stat-row {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    .stat-card {
        padding: 0.75rem;
        border-radius: 10px;
    }
    .stat-value {
        font-size: 1.2rem;
    }
    .stat-label {
        font-size: 0.68rem;
    }
    .stat-sub {
        font-size: 0.68rem;
    }

    /* ─── 数据表格：紧凑化 ─── */
    .data-table {
        font-size: 0.75rem;
    }
    .data-table th {
        padding: 0.5rem 0.5rem;
        font-size: 0.65rem;
    }
    .data-table td {
        padding: 0.45rem 0.5rem;
        font-size: 0.75rem;
    }
    /* 表格容器确保横向滚动 */
    .table-container,
    [style*="overflow-x:auto"] {
        -webkit-overflow-scrolling: touch;
    }

    /* ─── 操作按钮组 ─── */
    .action-btns {
        gap: 0.3rem;
    }
    .action-btns .btn,
    .action-btns .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }
    .task-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
        gap: 0.3rem;
    }

    /* ─── 内联 flex 布局优化 ─── */
    /* 带 justify-content:space-between 的 flex 容器 */
    [style*="display:flex"][style*="justify-content:space-between"] {
        flex-wrap: wrap !important;
        gap: 0.5rem;
    }
    /* 带 align-items:center 的 flex 容器 */
    [style*="display:flex"][style*="align-items:center"] {
        flex-wrap: wrap !important;
    }
    /* 带 align-items:end 的 flex 容器 */
    [style*="display:flex"][style*="align-items:end"],
    [style*="display:flex"][style*="align-items:flex-end"] {
        flex-wrap: wrap !important;
    }

    /* ─── 图表容器 ─── */
    /* ECharts 容器自适应 */
    .chart-container,
    [id*="chart"],
    [id*="Chart"] {
        width: 100% !important;
    }
    canvas {
        max-width: 100%;
    }

    /* ─── 回测页面特有组件 ─── */
    /* 对比表格容器 */
    .compare-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* 表格标题 */
    .table-title {
        font-size: 0.88rem;
    }
    .table-container {
        border-radius: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* ─── 历史筛选栏 ─── */
    .history-inline-filter {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    .history-inline-filter select {
        width: 100%;
        font-size: 16px;
    }
    .history-inline-filter .btn-refresh {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    /* ─── 设置页面组件 ─── */
    /* 设置区块 grid */
    .sett-section-grid {
        grid-template-columns: 1fr !important;
    }
    .sett-form-row {
        grid-template-columns: 1fr !important;
    }
    /* 设置芯片行 */
    .sett-chip-row {
        gap: 0.25rem;
    }

    /* ─── 期权链组件 ─── */
    .chain-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem;
    }

    /* ─── 通用内联样式覆盖 ─── */
    /* 内联 font-size 在手机端不要太大 */
    [style*="font-size:1.6rem"],
    [style*="font-size:1.8rem"],
    [style*="font-size:2rem"] {
        font-size: 1.2rem !important;
    }

    /* ─── 按钮行：全宽化 ─── */
    .modal-actions .btn,
    .config-panel .btn {
        width: 100%;
        justify-content: center;
    }

    /* ─── 卡片内标题行 ─── */
    .card-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .card-title-left {
        width: 100%;
    }

    /* ─── 滚动提示：表格横向滚动时的视觉提示 ─── */
    .table-wrapper {
        position: relative;
    }
    .table-wrapper::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 20px;
        background: linear-gradient(to right, transparent, rgba(10,14,23,0.6));
        pointer-events: none;
        opacity: 1;
        transition: opacity 0.3s;
        z-index: 1;
    }
    /* 滚动到最右时隐藏提示 */
    .table-wrapper.scrolled-end::after {
        opacity: 0;
    }

    /* ─── 空状态优化 ─── */
    .empty-state {
        padding: 1.5rem 0.75rem;
    }
    .empty-state .icon {
        font-size: 2rem;
    }
    .empty-state p {
        font-size: 0.82rem;
    }

    /* ─── 加载占位符 ─── */
    .loading-placeholder {
        height: 150px;
        font-size: 0.82rem;
    }
}

/* ── 超小屏幕 (≤375px) ── */
@media (max-width: 375px) {
    /* Tab 栏进一步紧凑 */
    .tab-item {
        padding: 0.4rem 0.65rem;
        font-size: 0.72rem;
    }

    /* 统计行降为单列 */
    .stat-row {
        grid-template-columns: 1fr !important;
    }

    /* 期权链降为 2 列 */
    .chain-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* 配置面板进一步紧凑 */
    .config-panel {
        padding: 0.75rem;
    }

    /* 筛选栏进一步紧凑 */
    .filter-bar {
        padding: 0.6rem 0.75rem;
    }
}


/* ═══════════════════════════════════════════════════════════════
   Phase 3 (P0): 页面级适配 — trade_account.html & dashboard.html
   
   trade_account 9 个 Tab 逐一适配：
   positions / today / orders / trading / analysis /
   autotrade / autoposition / sync / settings
   ═══════════════════════════════════════════════════════════════ */

/* ── 平板断点 (≤960px) ── */
@media (max-width: 960px) {

    /* ─── 实盘交易：trade-row 换行 ─── */
    .trade-row {
        flex-wrap: wrap;
    }
    .trade-group {
        min-width: 0;
        flex: 1 1 45%;
    }
    .trade-select, .trade-input {
        min-width: 0;
        width: 100%;
    }

    /* ─── 期权链：6列 ─── */
    .chain-grid {
        grid-template-columns: repeat(6, 1fr) !important;
    }

    /* ─── 快照卡片：3列 ─── */
    .snapshot-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    /* ─── 下单面板并排保持但缩小间距 ─── */
    .order-panel {
        padding: 1rem;
    }

    /* ─── 设置页统计行：3列 ─── */
    #settingsStatRow {
        grid-template-columns: repeat(3, 1fr) !important;
    }

    /* ─── 设置面板网格：单列 ─── */
    .sett-section-grid {
        grid-template-columns: 1fr !important;
    }

    /* ─── 额度规则栏：换行 ─── */
    .sett-rule-bar {
        flex-wrap: wrap;
        gap: 0.5rem;
        font-size: 0.78rem;
    }
}

/* ── 手机端主断点 (≤768px) ── */
@media (max-width: 768px) {

    /* ═══════════════════════════════════════
       trade_account 通用组件
       ═══════════════════════════════════════ */

    /* ─── trade-section 卡片 ─── */
    .trade-section {
        padding: 0.85rem 0.9rem;
        border-radius: 10px;
        margin-bottom: 0.75rem;
    }
    .trade-section-title {
        font-size: 0.85rem;
        margin-bottom: 0.6rem;
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    /* ─── trade-row / trade-group ─── */
    .trade-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    .trade-group {
        width: 100% !important;
        flex: none;
    }
    .trade-select, .trade-input {
        min-width: 0 !important;
        width: 100% !important;
        box-sizing: border-box;
        font-size: 16px; /* 防 iOS 缩放 */
    }
    .trade-label {
        font-size: 0.72rem;
    }

    /* ─── 交易按钮 ─── */
    .btn-trade {
        width: 100%;
        justify-content: center;
        padding: 0.65rem 1rem;
    }
    .btn-load, .btn-sell, .btn-buy {
        width: 100%;
        justify-content: center;
    }

    /* ─── 期权链：4列 ─── */
    .chain-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.35rem;
        padding: 0.4rem;
        max-height: 300px;
    }
    .chain-tag {
        padding: 0.35rem 0.2rem;
        font-size: 0.7rem;
    }

    /* ─── 快照卡片：2列 ─── */
    .snapshot-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem;
    }
    .snapshot-item {
        padding: 0.65rem;
        border-radius: 8px;
    }
    .snapshot-item .snap-label {
        font-size: 0.65rem;
    }
    .snapshot-item .snap-value {
        font-size: 1rem;
    }

    /* ─── 下单面板：纵向排列 ─── */
    [style*="grid-template-columns:1fr 1fr"][style*="gap:1rem"] > .order-panel {
        width: 100%;
    }
    .order-panel {
        padding: 0.85rem;
        border-radius: 10px;
    }
    .fee-display {
        font-size: 0.78rem;
    }

    /* ─── 快捷按钮 ─── */
    .quick-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.72rem;
    }
    .sync-quick-btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.78rem;
    }

    /* ═══════════════════════════════════════
       Tab: 我的持仓 (positions)
       ═══════════════════════════════════════ */

    /* 持仓顶部操作栏 */
    #tab-positions > div:first-child {
        flex-direction: column;
        align-items: stretch !important;
    }
    #tab-positions > div:first-child > div {
        width: 100%;
    }
    #tab-positions > div:first-child button {
        width: 100%;
        justify-content: center;
    }

    /* 📱 "全部市场"下拉框 — 极简紧凑风格 */
    #posMarketFilter {
        padding: 2px 6px !important;
        font-size: 0.7rem !important;
        border-radius: 4px !important;
        border: 1px solid rgba(51, 65, 85, 0.4) !important;
        background: transparent !important;
        color: #94a3b8 !important;
        font-weight: 500 !important;
        -webkit-appearance: none;
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%2394a3b8'/%3E%3C/svg%3E") !important;
        background-repeat: no-repeat !important;
        background-position: right 6px center !important;
        padding-right: 18px !important;
        height: auto !important;
        line-height: 1.2 !important;
        box-sizing: border-box !important;
    }

    /* 📱 "设置组合"按钮 — 极简紧凑风格 */
    .m-pos-combo-btn {
        padding: 1px 6px !important;
        font-size: 0.65rem !important;
        border-radius: 4px !important;
        border: 1px solid rgba(51, 65, 85, 0.4) !important;
        background: transparent !important;
        color: #94a3b8 !important;
        font-weight: 500 !important;
        height: auto !important;
        line-height: 1.3 !important;
        box-sizing: border-box !important;
    }

    /* 📱 止盈输入框 — 极简紧凑风格 */
    .m-pos-input-num {
        width: 42px !important;
        padding: 1px 3px !important;
        font-size: 0.65rem !important;
        border-radius: 4px !important;
        border: 1px solid rgba(51, 65, 85, 0.4) !important;
        background: transparent !important;
        color: var(--text-primary) !important;
        text-align: center !important;
        height: auto !important;
        line-height: 1.3 !important;
        box-sizing: border-box !important;
        -moz-appearance: textfield !important;
    }
    .m-pos-input-num::-webkit-inner-spin-button,
    .m-pos-input-num::-webkit-outer-spin-button {
        -webkit-appearance: none !important;
        margin: 0 !important;
    }

    /* 📱 说明输入框 — 极简紧凑风格 */
    .m-pos-input-text {
        padding: 1px 5px !important;
        font-size: 0.65rem !important;
        border-radius: 4px !important;
        border: 1px solid rgba(51, 65, 85, 0.4) !important;
        background: transparent !important;
        color: var(--text-primary) !important;
        height: auto !important;
        line-height: 1.3 !important;
        box-sizing: border-box !important;
    }

    /* 📱 "保存"按钮 — 极简紧凑风格 */
    .m-pos-save-btn {
        padding: 1px 6px !important;
        font-size: 0.62rem !important;
        border-radius: 4px !important;
        border: 1px solid rgba(51, 65, 85, 0.4) !important;
        background: transparent !important;
        color: #94a3b8 !important;
        font-weight: 500 !important;
        height: auto !important;
        line-height: 1.3 !important;
        box-sizing: border-box !important;
    }
    .m-pos-save-btn:active {
        background: rgba(6, 182, 212, 0.15) !important;
        border-color: #06b6d4 !important;
        color: #06b6d4 !important;
    }

    /* 📱 组合删除按钮 — 极简紧凑风格 */
    .m-pos-combo-del-btn {
        padding: 1px 5px !important;
        font-size: 0.6rem !important;
        border-radius: 4px !important;
        border: 1px solid rgba(51, 65, 85, 0.4) !important;
        background: transparent !important;
        color: #94a3b8 !important;
        height: auto !important;
        line-height: 1.3 !important;
        box-sizing: border-box !important;
    }

    /* 📱 持仓行内的止盈输入框和保存按钮（兼容旧渲染） */
    #positionGroupsContainer input[type="number"] {
        padding: 1px 3px !important;
        font-size: 0.65rem !important;
        border-radius: 4px !important;
        border: 1px solid rgba(51, 65, 85, 0.4) !important;
        background: transparent !important;
        width: 42px !important;
        text-align: center !important;
        height: auto !important;
        line-height: 1.3 !important;
        box-sizing: border-box !important;
        -moz-appearance: textfield !important;
    }
    #positionGroupsContainer input[type="number"]::-webkit-inner-spin-button,
    #positionGroupsContainer input[type="number"]::-webkit-outer-spin-button {
        -webkit-appearance: none !important;
        margin: 0 !important;
    }
    #positionGroupsContainer button[onclick*="updatePositionSetting"],
    #positionGroupsContainer button[onclick*="updateComboSetting"] {
        padding: 1px 6px !important;
        font-size: 0.62rem !important;
        border-radius: 4px !important;
        border: 1px solid rgba(51, 65, 85, 0.4) !important;
        background: transparent !important;
        color: #94a3b8 !important;
        font-weight: 500 !important;
        height: auto !important;
        line-height: 1.3 !important;
        box-sizing: border-box !important;
    }
    #positionGroupsContainer button[onclick*="openComboModal"] {
        padding: 1px 6px !important;
        font-size: 0.65rem !important;
        border-radius: 4px !important;
        border: 1px solid rgba(51, 65, 85, 0.4) !important;
        background: transparent !important;
        color: #94a3b8 !important;
        font-weight: 500 !important;
        height: auto !important;
        line-height: 1.3 !important;
        box-sizing: border-box !important;
    }

    /* 持仓汇总卡片 */
    #positionSummaryCards {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* 持仓分组卡片 */
    #positionGroupsContainer > div > div[style*="border-radius:12px"] {
        padding: 0.75rem 0.85rem;
    }
    /* 持仓分组头部 */
    #positionGroupsContainer [style*="justify-content:space-between"] {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.4rem;
    }
    /* 持仓数据行：7列 grid → 更紧凑 */
    #positionGroupsContainer [style*="grid-template-columns:3fr repeat(6"] {
        grid-template-columns: 2.5fr repeat(3, 1fr) !important;
        font-size: 0.72rem !important;
        gap: 0.3rem !important;
    }
    /* 隐藏持仓行的第5列(市值)和第7列(今日盈亏) */
    #positionGroupsContainer [style*="grid-template-columns:3fr repeat(6"] > div:nth-child(5),
    #positionGroupsContainer [style*="grid-template-columns:3fr repeat(6"] > div:nth-child(7) {
        display: none;
    }
    /* 持仓设置行 */
    #positionGroupsContainer [style*="display:flex"][style*="gap:1.5rem"] {
        gap: 0.75rem !important;
    }
    /* 组合说明 tips：移动端截断更短 */
    .combo-remark-tip {
        max-width: 80px !important;
    }
    .combo-remark-tip > span {
        max-width: 80px !important;
    }
    /* 组合设置行中的说明输入框：移动端自适应 */
    #positionGroupsContainer input[type="text"][id^="comboRemark_"] {
        width: 100px !important;
    }

    /* ─── 移动端持仓卡片样式 ─── */
    .m-pos-card {
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 12px;
        margin-bottom: 0.75rem;
        overflow: hidden;
    }

    /* 卡片头部 */
    .m-pos-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 0.85rem 0.5rem;
        gap: 0.5rem;
    }
    .m-pos-header-left {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        flex-wrap: wrap;
        min-width: 0;
    }
    .m-pos-stock-name {
        font-weight: 700;
        font-size: 0.95rem;
        color: var(--text-primary);
    }
    .m-pos-stock-code {
        font-size: 0.75rem;
        color: var(--text-muted);
        font-family: monospace;
    }
    .m-pos-count-badge {
        font-size: 0.68rem;
        padding: 1px 8px;
        border-radius: 4px;
        background: rgba(59,130,246,0.15);
        color: var(--accent-blue);
    }
    .m-pos-header-right {
        flex-shrink: 0;
    }
    .m-pos-pl-badge {
        font-size: 0.82rem;
        padding: 3px 10px;
        border-radius: 6px;
        font-weight: 600;
        white-space: nowrap;
    }

    /* 市值 + 设置组合按钮行 */
    .m-pos-meta-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0 0.85rem 0.6rem;
        gap: 0.5rem;
    }
    .m-pos-meta-item {
        font-size: 0.78rem;
        color: var(--text-secondary);
    }
    .m-pos-combo-btn {
        font-size: 0.65rem;
        padding: 1px 6px;
        border-radius: 4px;
        background: rgba(139,92,246,0.15);
        color: var(--accent-purple);
        border: 1px solid rgba(139,92,246,0.3);
        cursor: pointer;
        white-space: nowrap;
        box-sizing: border-box;
    }

    /* 持仓行 */
    .m-pos-row {
        border-top: 1px solid rgba(30,58,95,0.4);
        padding: 0.6rem 0.85rem;
    }
    .m-pos-row-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        margin-bottom: 0.3rem;
    }
    .m-pos-row-header-left {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        min-width: 0;
        flex: 1;
    }
    .m-pos-type-tag {
        font-size: 0.65rem;
        padding: 1px 6px;
        border-radius: 3px;
        font-weight: 600;
        flex-shrink: 0;
    }
    .m-pos-type-stock {
        background: rgba(16,185,129,0.15);
        color: var(--accent-green);
    }
    .m-pos-type-option {
        background: rgba(139,92,246,0.15);
        color: var(--accent-purple);
    }
    .m-pos-row-name {
        font-weight: 600;
        font-size: 0.85rem;
        color: var(--text-primary);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .m-pos-row-pl {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        flex-shrink: 0;
    }
    .m-pos-row-code {
        font-size: 0.7rem;
        color: var(--text-muted);
        font-family: monospace;
        padding: 0 0 0.3rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* 数据网格 */
    .m-pos-row-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 0.25rem;
        padding: 0.3rem 0;
    }
    .m-pos-data-cell {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .m-pos-data-label {
        font-size: 0.65rem;
        color: var(--text-muted);
        margin-bottom: 1px;
    }
    .m-pos-data-value {
        font-size: 0.78rem;
        color: var(--text-primary);
        font-variant-numeric: tabular-nums;
    }

    /* 设置行 */
    .m-pos-row-settings {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.35rem 0 0.1rem;
        flex-wrap: wrap;
        border-top: 1px dashed rgba(30,58,95,0.3);
        margin-top: 0.3rem;
    }
    .m-pos-setting-item {
        display: flex;
        align-items: center;
        gap: 0.25rem;
    }
    .m-pos-setting-label {
        font-size: 0.65rem;
        color: var(--text-muted);
    }

    /* 开关 */
    .m-pos-toggle {
        position: relative;
        display: inline-block;
        width: 36px;
        height: 20px;
        cursor: pointer;
    }
    .m-pos-toggle input {
        opacity: 0;
        width: 0;
        height: 0;
    }
    .m-pos-toggle-track {
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 0;
        border-radius: 20px;
        transition: all 0.3s;
    }
    .m-pos-toggle-thumb {
        position: absolute;
        top: 2px;
        width: 16px;
        height: 16px;
        background: #fff;
        border-radius: 50%;
        transition: all 0.3s;
        box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    }

    /* 输入框 */
    .m-pos-input-num {
        width: 42px;
        background: var(--bg-input);
        color: var(--text-primary);
        border: 1px solid var(--border);
        border-radius: 4px;
        padding: 1px 3px;
        font-size: 0.65rem;
        text-align: center;
        box-sizing: border-box;
        -moz-appearance: textfield;
    }
    .m-pos-input-num::-webkit-inner-spin-button,
    .m-pos-input-num::-webkit-outer-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
    .m-pos-input-text {
        flex: 1;
        min-width: 60px;
        background: var(--bg-input);
        color: var(--text-primary);
        border: 1px solid var(--border);
        border-radius: 4px;
        padding: 1px 5px;
        font-size: 0.65rem;
        box-sizing: border-box;
    }
    .m-pos-save-btn {
        background: rgba(59,130,246,0.2);
        color: var(--accent-blue);
        border: 1px solid rgba(59,130,246,0.3);
        border-radius: 4px;
        padding: 1px 6px;
        font-size: 0.62rem;
        cursor: pointer;
        transition: all 0.2s;
        white-space: nowrap;
        box-sizing: border-box;
    }

    /* 组合块 */
    .m-pos-combo-block {
        border: 1px solid rgba(139,92,246,0.25);
        border-radius: 8px;
        margin: 0.4rem 0.85rem;
        padding: 0.5rem 0.65rem;
        background: rgba(139,92,246,0.04);
    }
    .m-pos-combo-block .m-pos-row {
        padding: 0.5rem 0;
        border-top: 1px solid rgba(139,92,246,0.15);
    }
    .m-pos-combo-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.4rem;
        margin-bottom: 0.3rem;
        flex-wrap: wrap;
    }
    .m-pos-combo-header-left {
        display: flex;
        align-items: center;
        gap: 0.4rem;
        flex-wrap: wrap;
        min-width: 0;
    }
    .m-pos-combo-tag {
        font-size: 0.68rem;
        padding: 1px 8px;
        border-radius: 4px;
        background: rgba(139,92,246,0.2);
        color: var(--accent-purple);
        font-weight: 600;
        white-space: nowrap;
    }
    .m-pos-combo-name {
        font-size: 0.78rem;
        color: var(--text-primary);
        font-weight: 600;
        font-family: monospace;
    }
    .m-pos-combo-remark {
        font-size: 0.65rem;
        color: var(--accent-amber);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        max-width: 100px;
    }
    .m-pos-combo-del-btn {
        font-size: 0.6rem;
        padding: 1px 5px;
        border-radius: 4px;
        background: rgba(239,68,68,0.1);
        color: var(--accent-red);
        border: 1px solid rgba(239,68,68,0.2);
        cursor: pointer;
        white-space: nowrap;
        box-sizing: border-box;
    }
    .m-pos-combo-summary {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        font-size: 0.72rem;
        color: var(--text-muted);
        padding: 0.2rem 0 0.3rem;
        flex-wrap: wrap;
    }
    .m-pos-combo-settings {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        padding: 0.3rem 0;
        flex-wrap: wrap;
        border-bottom: 1px solid rgba(139,92,246,0.15);
    }

    /* ═══════════════════════════════════════
       Tab: 今日订单 (today)
       ═══════════════════════════════════════ */

    /* 今日订单操作栏 */
    #tab-today > div:first-child {
        flex-direction: column;
        align-items: stretch !important;
    }
    #tab-today > div:first-child > div {
        width: 100%;
        justify-content: space-between;
    }
    #tab-today > div:first-child button {
        width: 100%;
        justify-content: center;
    }

    /* 今日订单统计卡片 */
    #todayStatCards {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* 今日订单表格列隐藏：隐藏证券代码列(第2列) */
    .today-table th:nth-child(2),
    .today-table td:nth-child(2) {
        display: none;
    }
    .today-table {
        font-size: 0.72rem;
    }
    .today-table th {
        padding: 0.45rem 0.35rem;
        font-size: 0.65rem;
    }
    .today-table td {
        padding: 0.4rem 0.35rem;
    }

    /* ═══════════════════════════════════════
       Tab: 账户订单 (orders)
       ═══════════════════════════════════════ */

    /* 订单统计卡片 */
    #statCards {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* 订单表格列隐藏：隐藏正股(第3列)、市场(第7列) */
    #orderTableContainer .data-table th:nth-child(3),
    #orderTableContainer .data-table td:nth-child(3),
    #orderTableContainer .data-table th:nth-child(7),
    #orderTableContainer .data-table td:nth-child(7) {
        display: none;
    }

    /* 分页栏 */
    .pagination {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
    }
    .pagination-btns {
        flex-wrap: wrap;
        justify-content: center;
    }

    /* ═══════════════════════════════════════
       Tab: 实盘交易 (trading)
       ═══════════════════════════════════════ */

    /* Step 1 选择区域 */
    #tab-trading .trade-row {
        flex-direction: column;
    }
    #tab-trading .trade-group {
        width: 100% !important;
    }

    /* Step 3 下单面板纵向排列 */
    #orderSection > div[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* ═══════════════════════════════════════
       Tab: 收益分析 (analysis)
       ═══════════════════════════════════════ */

    /* 分析筛选条件 */
    #tab-analysis .card {
        padding: 0.85rem;
    }

    /* 分析统计卡片 */
    #analysisStats [style*="grid-template-columns:repeat(auto-fit"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* 分析图表高度 */
    #analysisChartCard [style*="height:400px"] {
        height: 250px !important;
    }

    /* 维度切换按钮组 */
    #analysisDimensionGroup {
        min-width: 0 !important;
    }
    #analysisDimensionGroup button {
        font-size: 0.75rem !important;
        padding: 0 0.5rem !important;
    }

    /* 月份快捷筛选栏 */
    #analysisMonthFilter {
        gap: 0.3rem !important;
    }
    #analysisMonthFilter button,
    #analysisMonthFilter .quick-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }

    /* 分析明细表格 */
    #analysisDetailCard {
        padding: 0.85rem;
    }

    /* ═══════════════════════════════════════
       Tab: 交易引擎 (autotrade)
       ═══════════════════════════════════════ */

    /* 止盈统计卡片 */
    #autoTradeStats {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* 止盈配置区域 4列 → 单列 */
    #tab-autotrade [style*="grid-template-columns:repeat(4"] {
        grid-template-columns: 1fr !important;
    }

    /* 止盈日志表格 */
    #tab-autotrade .data-table {
        font-size: 0.72rem;
    }

    /* 止盈持仓列表两栏 → 单列 */
    #tab-autotrade [style*="grid-template-columns:1fr 1fr;gap:1.5rem"] {
        grid-template-columns: 1fr !important;
    }

    /* ═══════════════════════════════════════
       Tab: 自动建仓 (autoposition)
       ═══════════════════════════════════════ */

    /* 建仓任务标题行 */
    #tab-autoposition .trade-section-title {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }
    #tab-autoposition .trade-section-title > div {
        width: 100%;
        justify-content: flex-start;
    }

    /* ═══════════════════════════════════════
       Tab: 订单同步 (sync)
       ═══════════════════════════════════════ */

    /* 同步统计卡片 */
    #syncOverviewStats {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* 同步两栏布局 → 单列 */
    #tab-sync > [style*="grid-template-columns:1fr 1fr;gap:1.5rem"] {
        grid-template-columns: 1fr !important;
    }

    /* 同步日期选择 */
    #tab-sync [style*="grid-template-columns:1fr 1fr;gap:1rem;margin-bottom:1.2rem"] {
        grid-template-columns: 1fr !important;
    }

    /* 同步市场选择卡片 */
    .sync-market-card {
        flex: 1;
        min-width: 0;
    }

    /* 同步结果统计 */
    #syncResultStats .stat-row {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* 同步记录面板 */
    #syncHistoryPanel {
        padding: 1rem;
    }

    /* ═══════════════════════════════════════
       Tab: 交易设置 (settings)
       ═══════════════════════════════════════ */

    /* 设置统计行：2列 */
    #settingsStatRow {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* 额度规则栏 */
    .sett-rule-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.4rem;
        padding: 0.75rem;
        font-size: 0.75rem;
    }
    .sett-rule-bar > span[style*="color:var(--text-muted)"] {
        display: none; /* 隐藏分隔符 | */
    }

    /* 设置面板 */
    .sett-panel {
        border-radius: 10px;
    }
    .sett-panel__head {
        padding: 0.75rem 0.85rem;
    }
    .sett-panel__body {
        padding: 0.85rem;
    }
    .sett-panel__title {
        font-size: 0.85rem;
    }

    /* 设置表单行 */
    .sett-form-row {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }

    /* 设置芯片行 */
    .sett-chip-row {
        gap: 0.2rem;
    }
    .sett-chip {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }

    /* 设置内联按钮 */
    .sett-btn-inline {
        width: 100%;
        justify-content: center;
        padding: 0.65rem 1rem;
    }

    /* ═══════════════════════════════════════
       自动建仓 Modal 适配
       ═══════════════════════════════════════ */

    /* Modal 内的 4列 grid → 2列 */
    #stockTaskModal [style*="grid-template-columns:1fr 1fr 1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
    }

    /* Modal 内的 2列 grid → 单列 */
    #stockTaskModal [style*="grid-template-columns:1fr 1fr;gap:1rem;margin-bottom:1rem"],
    #stockTaskModal [style*="grid-template-columns:1fr 1fr;gap:1rem;margin-top"] {
        grid-template-columns: 1fr !important;
    }

    /* ═══════════════════════════════════════
       dashboard.html 微调
       ═══════════════════════════════════════ */

    /* Dashboard 板块卡片 */
    .section-card {
        padding: 0.75rem 0.85rem;
        border-radius: 12px;
        margin-bottom: 0.75rem;
    }
    .section-title {
        font-size: 0.92rem;
    }

    /* Dashboard 筛选区域 */
    .section-filters {
        width: 100%;
        flex-direction: column;
        gap: 0.4rem;
    }
    .section-filters .filter-select,
    .section-filters .filter-input {
        width: 100%;
        min-width: 0 !important;
        font-size: 16px !important; /* 防 iOS 缩放 */
    }
    .section-filters .btn {
        width: 100%;
        justify-content: center;
    }

    /* Dashboard 图表高度 */
    .chart-wrapper {
        height: 200px;
        overflow: hidden;
    }

    /* Dashboard 两栏布局 */
    .two-col {
        grid-template-columns: 1fr !important;
        gap: 0.75rem;
    }

    /* Dashboard 任务列表紧凑化 — 不换行 */
    .task-mini-item {
        padding: 0.4rem 0.55rem;
        flex-wrap: nowrap;
    }
    .task-mini-left {
        flex-wrap: nowrap;
        gap: 0.25rem;
        overflow: hidden;
        min-width: 0;
    }
    .task-mini-name {
        font-size: 0.78rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .task-mini-meta {
        font-size: 0.68rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Dashboard 最近执行记录 */
    .log-mini-item {
        padding: 0.35rem 0.45rem;
        font-size: 0.75rem;
        flex-wrap: nowrap;
    }
    .log-mini-left {
        flex-wrap: nowrap;
        gap: 0.25rem;
        overflow: hidden;
        min-width: 0;
    }
    .log-mini-right {
        white-space: nowrap;
        flex-shrink: 0;
    }
}

/* ── 超小屏幕 (≤375px) ── */
@media (max-width: 375px) {

    /* 期权链：3列 */
    .chain-grid {
        grid-template-columns: repeat(3, 1fr) !important;
    }
    .chain-tag {
        font-size: 0.65rem;
        padding: 0.3rem 0.15rem;
    }

    /* 快照卡片：单列 */
    .snapshot-grid {
        grid-template-columns: 1fr !important;
    }

    /* 设置统计行：单列 */
    #settingsStatRow {
        grid-template-columns: 1fr !important;
    }

    /* 持仓/今日/订单统计卡片：单列 */
    #positionSummaryCards,
    #todayStatCards,
    #statCards,
    #autoTradeStats,
    #syncOverviewStats {
        grid-template-columns: 1fr !important;
    }

    /* Modal 内 4列 → 单列 */
    #stockTaskModal [style*="grid-template-columns:1fr 1fr 1fr 1fr"],
    #stockTaskModal [style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* trade-section 进一步紧凑 */
    .trade-section {
        padding: 0.65rem 0.7rem;
    }

    /* 持仓数据行：超小屏进一步隐藏列 */
    #positionGroupsContainer [style*="grid-template-columns:3fr repeat(6"] {
        grid-template-columns: 2fr repeat(2, 1fr) !important;
    }
    /* 超小屏额外隐藏第4列(现价) */
    #positionGroupsContainer [style*="grid-template-columns:3fr repeat(6"] > div:nth-child(4) {
        display: none;
    }

    /* 今日订单表格：超小屏额外隐藏成交数量(第7列)和成交均价(第8列) */
    .today-table th:nth-child(7),
    .today-table td:nth-child(7),
    .today-table th:nth-child(8),
    .today-table td:nth-child(8) {
        display: none;
    }

    /* 账户订单表格：超小屏额外隐藏成交数量(第10列)和成交均价(第11列) */
    #orderTableContainer .data-table th:nth-child(10),
    #orderTableContainer .data-table td:nth-child(10),
    #orderTableContainer .data-table th:nth-child(11),
    #orderTableContainer .data-table td:nth-child(11) {
        display: none;
    }

    /* Dashboard 图表更矮 */
    .chart-wrapper {
        height: 170px;
        overflow: hidden;
    }
}


/* ═══════════════════════════════════════════════════════════
   Phase 3 (P1): backtest / monitor / admin 页面级适配
   ═══════════════════════════════════════════════════════════ */

/* ── P1-1: backtest.html (期权回测) ─────────────────────── */

@media (max-width: 960px) {
    /* 回测配置表单：960px 时 2 列 */
    .config-grid {
        grid-template-columns: 1fr 1fr !important;
    }
    /* 回测对比表格：紧凑化 */
    .compare-table th,
    .compare-table td {
        padding: 0.5rem 0.4rem !important;
        font-size: 0.78rem !important;
    }
}

@media (max-width: 768px) {
    /* 回测配置表单：手机端单列，保证输入框宽度充足 */
    .config-grid {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    /* 回测汇总统计：2 列 */
    .summary-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.6rem !important;
    }
    .summary-card {
        padding: 0.75rem 0.6rem !important;
        border-radius: 10px !important;
    }
    .summary-label {
        font-size: 0.72rem !important;
    }
    .summary-value {
        font-size: 1.2rem !important;
    }
    /* 回测对比表格容器：横向滚动 */
    .compare-table-wrap {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        padding: 0.75rem !important;
    }
    .compare-table {
        min-width: 600px;
    }
    .compare-table th,
    .compare-table td {
        padding: 0.35rem 0.3rem !important;
        font-size: 0.72rem !important;
        white-space: nowrap;
    }
    /* 回测对比表格删除按钮：紧凑 */
    .compare-table .del-btn {
        padding: 0.2rem 0.4rem !important;
        font-size: 0.7rem !important;
    }
    /* AI 解读弹窗：手机端全屏 */
    .ai-modal {
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    /* 回测 JS 动态生成的 2 列 grid → 保持 2 列 */
    /* 注意：不再强制单列，保持紧凑的 2 列布局 */
}

/* ── P1-2: monitor.html (异动监控) ──────────────────────── */

@media (max-width: 960px) {
    /* 任务元信息：紧凑间距 */
    .task-meta {
        gap: 0.75rem !important;
    }
}

@media (max-width: 768px) {
    /* 任务头部：纵向排列 */
    .task-header {
        flex-direction: column;
        align-items: flex-start !important;
    }
    /* 任务操作按钮：换行 + 全宽 */
    .task-actions {
        width: 100%;
        flex-wrap: wrap;
        gap: 0.4rem !important;
    }
    .task-actions .btn {
        flex: 1;
        min-width: 0;
        justify-content: center;
    }
    .task-actions .toggle {
        flex: none;
    }
    /* 任务元信息：紧凑 + 2 列 */
    .task-meta {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem !important;
        font-size: 0.78rem !important;
    }
    .task-meta-item {
        flex-direction: column;
        gap: 0.15rem !important;
    }
    /* 策略块：紧凑 */
    .strategy-block {
        padding: 0.75rem !important;
    }
    .strategy-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem;
    }
    /* 条件行：纵向排列 */
    .condition-row {
        flex-direction: column;
        align-items: stretch !important;
    }
    .condition-row .cond-metric,
    .condition-row .cond-operator,
    .condition-row .cond-value {
        width: 100% !important;
    }
    /* 时段行：纵向 */
    .time-period-row {
        flex-direction: column;
        align-items: stretch !important;
    }
    .time-period-row .form-input {
        width: 100% !important;
    }
    .time-period-label {
        text-align: left !important;
    }
    /* 引擎状态徽章：紧凑 */
    .engine-badge {
        font-size: 0.75rem !important;
        padding: 0.35rem 0.75rem !important;
    }
    /* 结果表格：横向滚动 */
    #resultModal .table-wrapper,
    #logModal .table-wrapper {
        -webkit-overflow-scrolling: touch;
    }
    #resultModal .table-wrapper table,
    #logModal .table-wrapper table {
        min-width: 700px;
    }
}

/* ── P1-3: admin.html (系统管理) ────────────────────────── */

@media (max-width: 960px) {
    /* 健康组件 grid：3 列 */
    #healthComponentsContainer > div {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 768px) {
    /* 用户管理表格：横向滚动 */
    #userTableContainer {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    #userTableContainer .data-table {
        min-width: 600px;
    }
    /* 操作按钮组：紧凑 */
    .action-btns {
        gap: 0.25rem !important;
    }
    .action-btns .btn {
        padding: 0.25rem 0.5rem !important;
        font-size: 0.72rem !important;
    }
    /* 健康组件 grid：2 列 */
    #healthComponentsContainer > div {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* 错误统计 grid：2 列 */
    #healthStatsContainer > div:first-child {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* 错误日志筛选栏：纵向 */
    #tab-health .card > div[style*="flex-wrap:wrap"] {
        flex-direction: column;
        align-items: stretch !important;
    }
    /* 错误日志表格：横向滚动 */
    #healthErrorsContainer {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    #healthErrorsContainer .data-table {
        min-width: 700px;
    }
    /* 日志管理表格：紧凑 */
    #logsOverviewContainer .data-table th,
    #logsOverviewContainer .data-table td {
        padding: 0.4rem 0.5rem !important;
        font-size: 0.78rem !important;
    }
    /* 股票配置表格：横向滚动 */
    #stockConfigContainer {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    #stockConfigContainer .data-table {
        min-width: 550px;
    }
    /* AI 模型表格：横向滚动 */
    #llmModelContainer {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    #llmModelContainer .data-table {
        min-width: 700px;
    }
    /* 登录日志弹窗：全屏 */
    .modal-wide {
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    /* 告警横幅：纵向 */
    #healthAlertBanner {
        flex-direction: column;
        text-align: center;
    }
    #healthAlertBanner .btn {
        margin-left: 0 !important;
        width: 100%;
    }
    /* OpenD 交易控制：纵向 */
    #opendTradeContainer div[style*="justify-content:space-between"] {
        flex-direction: column !important;
        gap: 0.75rem;
    }
    #opendTradeContainer div[style*="justify-content:space-between"] > div:last-child {
        width: 100%;
    }
    #opendTradeContainer div[style*="justify-content:space-between"] .btn {
        flex: 1;
    }
}


/* ═══════════════════════════════════════════════════════════
   Phase 3 (P2): scheduler / option_daily / stock_query /
                 option_query / option_import / option_detail /
                 login 页面级适配
   ═══════════════════════════════════════════════════════════ */

/* ── P2-1: scheduler.html (定时任务) ────────────────────── */

@media (max-width: 768px) {
    /* 统计看板：2 列 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .stat-card {
        padding: 0.85rem !important;
    }
    .stat-icon {
        font-size: 1.4rem !important;
        margin-bottom: 0.3rem !important;
    }
    .stat-value {
        font-size: 1.2rem !important;
    }
    /* 任务列表卡片标题：按钮组换行 */
    .card-title {
        flex-wrap: wrap;
    }
    .card-title > div[style*="display:flex"] {
        width: 100%;
        flex-wrap: wrap;
    }
    .card-title > div[style*="display:flex"] .btn {
        flex: 1;
        min-width: 0;
        justify-content: center;
        font-size: 0.78rem !important;
        padding: 0.5rem 0.5rem !important;
    }
    /* 告警横幅：紧凑 */
    .alert-banner {
        padding: 0.75rem !important;
        font-size: 0.82rem !important;
    }
    /* 标签输入框：全宽 */
    .tag-input-wrapper {
        min-height: 38px !important;
    }
    .stock-tag {
        font-size: 0.72rem !important;
    }
}

@media (max-width: 375px) {
    /* 统计看板：超小屏保持 2 列 */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ── P2-2: option_daily.html (当日期权入库) ─────────────── */

@media (max-width: 768px) {
    /* 步骤指示器：换行 + 紧凑 */
    .steps {
        flex-wrap: wrap;
        gap: 0.35rem !important;
    }
    .step {
        padding: 0.35rem 0.65rem !important;
        font-size: 0.78rem !important;
    }
    .step-num {
        width: 20px !important;
        height: 20px !important;
        font-size: 0.68rem !important;
    }
    .step-arrow {
        font-size: 0.7rem !important;
    }
    /* 表单行：纵向 */
    .form-row {
        flex-direction: column;
    }
    .form-row .form-group {
        width: 100%;
    }
    .form-row .form-input,
    .form-row .form-select {
        width: 100% !important;
    }
    /* 行权价筛选面板：纵向 */
    .filter-panel {
        flex-direction: column;
        align-items: stretch !important;
        gap: 0.5rem !important;
    }
    .filter-panel .filter-input {
        width: 100% !important;
    }
    .filter-panel .filter-label {
        margin-bottom: 0;
    }
    .filter-preset-tags {
        width: 100%;
    }
    .filter-stat {
        margin-left: 0 !important;
        text-align: center;
    }
    /* 选择栏：纵向 */
    .select-bar {
        flex-direction: column;
        align-items: stretch !important;
    }
    .select-bar .btn {
        width: 100%;
        justify-content: center;
    }
    /* Greeks 数据卡片：2 列 */
    .greeks-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* 入库结果表格：横向滚动 */
    .import-result-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    /* 快速标签：紧凑 */
    .quick-tags {
        gap: 0.35rem !important;
    }
    .quick-tag {
        padding: 0.2rem 0.55rem !important;
        font-size: 0.72rem !important;
    }
}

@media (max-width: 375px) {
    /* Greeks 数据卡片：超小屏单列 */
    .greeks-grid {
        grid-template-columns: 1fr !important;
    }
    /* 步骤指示器：隐藏箭头 */
    .step-arrow {
        display: none;
    }
}

/* ── P2-3: stock_query.html (股票数据查询) ──────────────── */

@media (max-width: 768px) {
    /* 筛选栏：纵向全宽 */
    .filter-bar {
        flex-direction: column;
        align-items: stretch !important;
    }
    .filter-group {
        width: 100%;
    }
    .filter-input,
    .filter-select {
        width: 100% !important;
    }
    /* 统计行：2 列 */
    .stats-row {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* 图表容器：自适应高度 */
    .chart-container,
    [id*="chart"] canvas {
        max-height: 300px;
    }
}

@media (max-width: 375px) {
    /* 统计行：超小屏单列 */
    .stats-row {
        grid-template-columns: 1fr !important;
    }
}

/* ── P2-4: option_query.html (期权数据查询) ─────────────── */

@media (max-width: 768px) {
    /* 统计面板：2 列 */
    .stats-row {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .stat-card {
        padding: 0.75rem !important;
    }
    .stat-value {
        font-size: 1.1rem !important;
    }
    /* 期权数据表格：横向滚动 */
    .table-wrapper {
        -webkit-overflow-scrolling: touch;
    }
    .table-wrapper table {
        min-width: 600px;
    }
}

/* ── P2-5: option_import.html (期权数据导入) ────────────── */

@media (max-width: 768px) {
    /* 步骤指示器：已由 option_daily 覆盖 */
    /* 表单行：已由 option_daily 覆盖 */
    /* 期权链表格：横向滚动 */
    #chainContent .table-wrapper {
        -webkit-overflow-scrolling: touch;
    }
    #chainContent .table-wrapper table {
        min-width: 500px;
    }
    /* 筛选面板：已由 option_daily 覆盖 */
}

/* ── P2-6: option_detail.html (期权详情) ────────────────── */

@media (max-width: 768px) {
    /* 概要信息网格：2 列 */
    .info-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    .info-item {
        padding: 0.65rem 0.75rem !important;
    }
    .info-label {
        font-size: 0.68rem !important;
    }
    .info-value {
        font-size: 0.9rem !important;
    }
    /* K 线图表容器：自适应高度 */
    .chart-container {
        height: 350px !important;
    }
    /* 返回链接 */
    .back-link {
        font-size: 0.82rem !important;
    }
}

@media (max-width: 375px) {
    /* 概要信息网格：超小屏单列 */
    .info-grid {
        grid-template-columns: 1fr !important;
    }
    /* 图表更矮 */
    .chart-container {
        height: 280px !important;
    }
}

/* ── P2-7: login.html (登录页) ──────────────────────────── */

@media (max-width: 768px) {
    /* 登录容器：全宽 + 紧凑 */
    .login-container {
        padding: 0 1rem !important;
    }
    .login-card {
        padding: 1.5rem !important;
    }
    .login-title {
        font-size: 1.3rem !important;
    }
    .login-logo {
        font-size: 2.5rem !important;
    }
    .login-subtitle {
        font-size: 0.82rem !important;
    }
}

@media (max-width: 375px) {
    .login-card {
        padding: 1.25rem !important;
    }
}


/* ═══════════════════════════════════════════════════════════
   Phase 3 (P1+P2) 通用补充：所有页面共享
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    /* 所有页面标题：紧凑 */
    .page-title {
        font-size: 1.3rem !important;
    }
    .page-desc {
        font-size: 0.82rem !important;
    }
    /* 页面头部：纵向排列 */
    .page-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }
    /* 所有卡片：紧凑内边距 */
    .card {
        padding: 1rem 1rem !important;
        border-radius: 12px !important;
    }
    /* 所有 Modal：手机端全屏 */
    .modal-overlay.show {
        align-items: stretch;
    }
    .modal {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        margin: 0;
    }
    .modal-wide {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
    /* 所有表格容器：触摸滚动 */
    .table-wrapper {
        -webkit-overflow-scrolling: touch;
    }
    /* 所有空状态：紧凑 */
    .empty-state {
        padding: 2rem 1rem !important;
    }
    .empty-state .icon {
        font-size: 2.5rem !important;
    }
    /* 所有 Toggle 开关：确保触摸友好 */
    .toggle {
        min-width: 44px;
        min-height: 24px;
    }
    /* 所有 quick-tags：紧凑 */
    .quick-tags {
        gap: 0.3rem !important;
    }
    .quick-tag {
        padding: 0.2rem 0.55rem !important;
        font-size: 0.72rem !important;
    }
    /* 所有 form-hint：紧凑 */
    .form-hint {
        font-size: 0.68rem !important;
    }
    /* 所有 status-badge：紧凑 */
    .status-badge {
        font-size: 0.68rem !important;
        padding: 0.15rem 0.45rem !important;
    }
}

@media (max-width: 375px) {
    /* 超小屏：页面标题更小 */
    .page-title {
        font-size: 1.15rem !important;
    }
    .page-desc {
        font-size: 0.75rem !important;
    }
    /* 超小屏：卡片更紧凑 */
    .card {
        padding: 0.75rem 0.75rem !important;
    }
}


/* ═══════════════════════════════════════════════════════════
   Phase 4: 交互体验优化
   ═══════════════════════════════════════════════════════════ */

/* ── 4.1 底部安全区扩展 ─────────────────────────────────── */

@media (max-width: 768px) {
    /* Modal 底部按钮区域：安全区 */
    .modal-footer,
    .modal-actions,
    .modal > div:last-child {
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0)) !important;
    }
    /* 固定底部操作栏：安全区 */
    .fixed-bottom-bar,
    .bottom-actions {
        padding-bottom: calc(0.75rem + env(safe-area-inset-bottom, 0)) !important;
    }
    /* 全屏 Modal 内的底部按钮 */
    .modal .btn-group:last-child,
    .modal .form-actions:last-child {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
}

/* ── 4.2 骨架屏动画 ─────────────────────────────────────── */

/* 骨架屏基础样式 */
.skeleton {
    position: relative;
    overflow: hidden;
    background: rgba(30, 58, 95, 0.15) !important;
    border-radius: 6px;
    color: transparent !important;
    pointer-events: none;
    user-select: none;
}
.skeleton * {
    visibility: hidden !important;
}
.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.04) 40%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.04) 60%,
        transparent 100%
    );
    animation: skeletonShimmer 1.5s ease-in-out infinite;
}
@keyframes skeletonShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* 骨架屏预设尺寸 */
.skeleton-text {
    height: 0.9rem;
    width: 80%;
    margin-bottom: 0.5rem;
}
.skeleton-text-short {
    height: 0.9rem;
    width: 50%;
    margin-bottom: 0.5rem;
}
.skeleton-title {
    height: 1.3rem;
    width: 60%;
    margin-bottom: 0.75rem;
}
.skeleton-card {
    height: 120px;
    width: 100%;
    margin-bottom: 0.75rem;
    border-radius: 12px;
}
.skeleton-chart {
    height: 200px;
    width: 100%;
    margin-bottom: 0.75rem;
    border-radius: 12px;
}
.skeleton-table-row {
    height: 2.5rem;
    width: 100%;
    margin-bottom: 0.35rem;
    border-radius: 6px;
}
.skeleton-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}
.skeleton-badge {
    height: 1.2rem;
    width: 4rem;
    border-radius: 9999px;
}

/* 骨架屏容器 */
.skeleton-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
}
.skeleton-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.skeleton-row .skeleton-text {
    flex: 1;
    margin-bottom: 0;
}

/* ── 4.3 横屏适配 ────────────────────────────────────────── */

/* 手机横屏时的特殊处理 */
@media (max-width: 960px) and (orientation: landscape) {
    /* 横屏时隐藏底部 Tab 栏，增大内容区域 */
    .mobile-tabbar {
        height: 44px !important;
    }
    .mobile-tabbar__icon {
        font-size: 15px !important;
    }
    .mobile-tabbar__label {
        font-size: 0.55rem !important;
    }
    /* 横屏时顶部栏更矮 */
    .mobile-topbar {
        height: 40px !important;
    }
    body {
        padding-top: 40px !important;
        padding-bottom: 44px !important;
    }
    /* 横屏时图表容器更高 */
    .chart-wrapper,
    .chart-container {
        max-height: 60vh !important;
        min-height: 200px !important;
        overflow: hidden !important;
    }
    /* 横屏时卡片减少内边距 */
    .card {
        padding: 0.65rem 0.75rem !important;
    }
    /* 横屏时统计行保持 2 列 */
    .stat-row {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* 横屏时 Modal 不全屏，保留边距 */
    .modal {
        max-height: 95vh !important;
        border-radius: 12px !important;
        margin: 2.5vh auto !important;
        width: 90% !important;
    }
}

/* 图表全屏模式（JS 动态添加 class） */
.chart-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 9999 !important;
    background: var(--bg-primary, #0a0e17) !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
}
.chart-fullscreen .chart-wrapper,
.chart-fullscreen .chart-container,
.chart-fullscreen canvas,
.chart-fullscreen [id*="chart"] {
    width: 100% !important;
    height: 100% !important;
    max-height: 100vh !important;
    min-height: 100vh !important;
}
/* 全屏模式关闭按钮 */
.chart-fullscreen-close {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 10000;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 150ms;
}
.chart-fullscreen-close:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* ── 4.4 触摸反馈 ────────────────────────────────────────── */

@media (max-width: 768px) {
    /* 按钮点击态 */
    .btn:active,
    button:active,
    .seg-sub__item:active,
    .mobile-drawer__item:active,
    .mobile-tabbar__item:active {
        transform: scale(0.97);
        opacity: 0.85;
    }
    /* 卡片点击态（可点击的卡片） */
    .card[onclick]:active,
    .card[data-clickable]:active,
    a.card:active {
        transform: scale(0.98);
        opacity: 0.9;
    }
    /* 列表项点击态 */
    .list-item:active,
    tr:active {
        background: rgba(59, 130, 246, 0.05) !important;
    }
    /* 过渡动画 */
    .btn,
    button,
    .card[onclick],
    .card[data-clickable],
    a.card,
    .mobile-drawer__item,
    .mobile-tabbar__item {
        transition: transform 100ms ease, opacity 100ms ease;
    }
}

/* ── 4.5 下拉刷新指示器 ─────────────────────────────────── */

.pull-to-refresh {
    position: fixed;
    top: 54px; /* 手机端顶部栏高度 */
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    z-index: 98;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: rgba(14, 21, 37, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 9999px;
    color: #94a3b8;
    font-size: 0.78rem;
    font-weight: 500;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.3s ease;
    opacity: 0;
    pointer-events: none;
}
.pull-to-refresh.pulling {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.pull-to-refresh.refreshing {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}
.pull-to-refresh__spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(96, 165, 250, 0.3);
    border-top-color: #60a5fa;
    border-radius: 50%;
    animation: ptrSpin 0.6s linear infinite;
    display: none;
}
.pull-to-refresh.refreshing .pull-to-refresh__spinner {
    display: block;
}
.pull-to-refresh__arrow {
    font-size: 1rem;
    transition: transform 0.2s ease;
}
.pull-to-refresh.ready .pull-to-refresh__arrow {
    transform: rotate(180deg);
}
.pull-to-refresh.refreshing .pull-to-refresh__arrow {
    display: none;
}
@keyframes ptrSpin {
    to { transform: rotate(360deg); }
}

/* ── 4.6 手势滑动提示 ───────────────────────────────────── */

@media (max-width: 768px) {
    /* 首次滑动提示动画（表格） */
    .table-wrapper.show-swipe-hint::before {
        content: '👆 左右滑动查看更多';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 10;
        padding: 0.5rem 1rem;
        background: rgba(14, 21, 37, 0.9);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        color: #94a3b8;
        font-size: 0.75rem;
        white-space: nowrap;
        pointer-events: none;
        animation: swipeHintFade 3s ease forwards;
    }
    @keyframes swipeHintFade {
        0% { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
        15% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
        70% { opacity: 1; }
        100% { opacity: 0; }
    }
}

/* ── 4.7 页面过渡动画 ───────────────────────────────────── */

@media (max-width: 768px) {
    /* 页面内容淡入 */
    .main,
    main,
    .page-content {
        animation: mobilePageFadeIn 0.3s ease;
    }
    @keyframes mobilePageFadeIn {
        from {
            opacity: 0;
            transform: translateY(8px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    /* Tab 切换内容淡入 */
    .tab-content.active,
    [id^="tab-"].active {
        animation: mobileTabFadeIn 0.25s ease;
    }
    @keyframes mobileTabFadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

/* ── 4.8 滚动优化 ────────────────────────────────────────── */

@media (max-width: 768px) {
    /* 平滑滚动 */
    html {
        scroll-behavior: smooth;
    }
    /* 弹性滚动 */
    .modal-body,
    .mobile-drawer,
    .table-wrapper {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    /* 回到顶部按钮 */
    .scroll-to-top {
        position: fixed;
        bottom: calc(70px + env(safe-area-inset-bottom, 0));
        right: 12px;
        z-index: 90;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        background: rgba(59, 130, 246, 0.9);
        border: none;
        color: #fff;
        font-size: 1.1rem;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
        opacity: 0;
        transform: scale(0.8);
        transition: opacity 0.3s, transform 0.3s;
        pointer-events: none;
    }
    .scroll-to-top.visible {
        opacity: 1;
        transform: scale(1);
        pointer-events: auto;
    }
    .scroll-to-top:active {
        transform: scale(0.9);
    }
}

/* ── 4.9 Toast 通知（手机端优化） ────────────────────────── */

@media (max-width: 768px) {
    /* Toast 通知：底部居中，避开 tabbar */
    .toast,
    .notification {
        bottom: calc(70px + env(safe-area-inset-bottom, 0)) !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        right: auto !important;
        max-width: calc(100vw - 2rem) !important;
        font-size: 0.82rem !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Phase 2: 核心页面增强（参考设计文档 v2.0）
   ═══════════════════════════════════════════════════════════════ */

/* ── 5.1 Hero 区域增强 ───────────────────────────────────── */
@media (max-width: 768px) {
    /* Hero 区域：渐变光晕背景 */
    .page-header {
        position: relative;
        padding: 16px 16px 12px;
        margin-bottom: 0.75rem;
    }
    .page-header::before {
        content: '';
        position: absolute;
        top: -30px; left: 0; right: 0;
        height: 120px;
        background: radial-gradient(ellipse at 50% 0%, rgba(6,182,212,.12) 0%, transparent 65%);
        pointer-events: none;
        z-index: -1;
    }
    .page-title {
        font-size: 1.2rem;
        font-weight: 800;
        letter-spacing: -0.02em;
    }
    .page-desc {
        font-size: 0.78rem;
        color: var(--text-muted, #64748b);
        line-height: 1.4;
    }
}

/* ── 5.2 数据网格 2×2 ────────────────────────────────────── */
@media (max-width: 768px) {
    .data-grid-2x2 {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin-bottom: 14px;
    }
    .data-cell {
        background: var(--bg-card, #1a2332);
        border: 1px solid var(--border, #1e3a5f);
        border-radius: 12px;
        padding: 12px 14px;
        text-align: center;
    }
    .data-cell-label {
        font-size: 0.7rem;
        color: var(--text-muted, #64748b);
        margin-bottom: 4px;
    }
    .data-cell-value {
        font-size: 1.1rem;
        font-weight: 700;
        font-variant-numeric: tabular-nums;
    }
    .data-cell-sub {
        font-size: 0.65rem;
        color: var(--text-muted, #64748b);
        margin-top: 2px;
    }
}

/* ── 5.3 横滑指标芯片 ────────────────────────────────────── */
@media (max-width: 768px) {
    .metrics-scroll {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        padding: 4px 0 10px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .metrics-scroll::-webkit-scrollbar { display: none; }
    .metric-chip {
        flex-shrink: 0;
        background: var(--bg-card, #1a2332);
        border: 1px solid var(--border, #1e3a5f);
        border-radius: 10px;
        padding: 11px 14px;
        min-width: 105px;
        transition: all 150ms;
    }
    .metric-chip:active {
        transform: scale(0.97);
    }
    .metric-label {
        font-size: 0.7rem;
        color: var(--text-muted, #64748b);
        margin-bottom: 4px;
    }
    .metric-value {
        font-size: 0.95rem;
        font-weight: 700;
        font-variant-numeric: tabular-nums;
    }
}

/* ── 5.4 筛选标签栏（filter-bar 横滑pill） ──────────────── */
@media (max-width: 768px) {
    .filter-tag-bar {
        display: flex;
        gap: 6px;
        padding: 0 16px 14px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .filter-tag-bar::-webkit-scrollbar { display: none; }
    .filter-tag {
        flex-shrink: 0;
        padding: 6px 13px;
        border-radius: 999px;
        border: 1px solid var(--border, #334155);
        background: transparent;
        color: var(--text-secondary, #94a3b8);
        font-size: 0.72rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 150ms;
        white-space: nowrap;
    }
    .filter-tag:hover {
        border-color: var(--color-border-light, #475569);
        color: var(--text-primary, #e2e8f0);
    }
    .filter-tag.active {
        background: rgba(6,182,212,.15);
        border-color: var(--color-accent-cyan, #06b6d4);
        color: var(--color-accent-cyan, #06b6d4);
    }
}

/* ── 5.5 列表项组件（三段式） ─────────────────────────────── */
@media (max-width: 768px) {
    .list-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 14px 16px;
        border-bottom: 1px solid rgba(51,65,85,.3);
        transition: background 150ms;
    }
    .list-item:active {
        background: rgba(6,182,212,.04);
    }
    .li-toggle {
        flex-shrink: 0;
    }
    .li-main {
        flex: 1;
        min-width: 0;
    }
    .li-name {
        font-size: 0.88rem;
        font-weight: 600;
        color: var(--text-primary, #e2e8f0);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .li-desc {
        font-size: 0.72rem;
        color: var(--text-muted, #64748b);
        margin-top: 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .li-right {
        flex-shrink: 0;
        text-align: right;
    }
    .li-value {
        font-size: 0.95rem;
        font-weight: 700;
        font-variant-numeric: tabular-nums;
    }
    .li-change {
        font-size: 0.72rem;
        font-weight: 600;
        margin-top: 2px;
    }
    .li-change.change-up { color: var(--color-up, #ef4444); }
    .li-change.change-down { color: var(--color-down, #10b981); }
}

/* ── 5.6 入场动画 ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .animate-in {
        animation: mobileSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
    }
    .animate-in.d1 { animation-delay: 0ms; }
    .animate-in.d2 { animation-delay: 60ms; }
    .animate-in.d3 { animation-delay: 120ms; }
    .animate-in.d4 { animation-delay: 180ms; }
    .animate-in.d5 { animation-delay: 240ms; }
    .animate-in.d6 { animation-delay: 300ms; }
    .animate-in.d7 { animation-delay: 360ms; }
    .animate-in.d8 { animation-delay: 420ms; }

    @keyframes mobileSlideIn {
        from { opacity: 0; transform: translateY(12px); }
        to   { opacity: 1; transform: translateY(0); }
    }
}

/* ── 5.7 按压反馈增强 ─────────────────────────────────────── */
@media (max-width: 768px) {
    /* 卡片按压反馈 */
    .card:active,
    .task-item:active,
    .stat-mini:active {
        transform: scale(0.98);
        transition: transform 100ms;
    }
    /* 按钮按压反馈 */
    .btn:active,
    .quick-btn:active,
    .quick-tag:active,
    .filter-tag:active {
        transform: scale(0.95);
        transition: transform 80ms;
    }
}

/* ── 5.8 等宽数字字体 ─────────────────────────────────────── */
@media (max-width: 768px) {
    /* 所有价格/数值使用等宽字体 */
    .stat-val,
    .stat-value,
    .price,
    .stock-price,
    .li-value,
    .metric-value,
    .data-cell-value,
    [class*="ratio"],
    td:nth-child(n+2) {
        font-variant-numeric: tabular-nums;
        font-family: var(--font-mono, 'SF Mono', 'JetBrains Mono', 'Menlo', monospace);
    }
}

/* ── 5.9 FAB 浮动按钮 ─────────────────────────────────────── */
@media (max-width: 768px) {
    .fab-btn {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 10px 18px;
        border-radius: 999px;
        border: none;
        font-size: 0.82rem;
        font-weight: 600;
        cursor: pointer;
        transition: all 200ms;
        box-shadow: 0 4px 16px rgba(0,0,0,.3);
    }
    .fab-btn.fab-add {
        background: linear-gradient(135deg, #06B6D4, #3B82F6);
        color: #fff;
    }
    .fab-btn:active {
        transform: scale(0.95);
    }
}

/* ── 5.10 监控卡片增强 ────────────────────────────────────── */
@media (max-width: 768px) {
    .monitor-card {
        position: relative;
        border-left: 4px solid transparent;
        border-radius: 12px;
        padding: 14px 16px;
        margin-bottom: 10px;
        background: var(--bg-card, #1a2332);
        border-color: var(--border, #1e3a5f);
    }
    .monitor-card.running {
        border-left-color: var(--color-success, #10b981);
    }
    .monitor-card.paused {
        border-left-color: var(--accent-amber, #f59e0b);
    }
    .monitor-card.stopped {
        border-left-color: var(--color-danger, #ef4444);
    }
}

/* ── 5.11 子页签存在时的页面内容调整 ──────────────────────── */
@media (max-width: 768px) {
    /* 有子页签时，页面内的 tab-bar 隐藏（避免重复） */
    body.has-mobile-subtabs .tab-bar[style*="display:none"],
    body.has-mobile-subtabs .tab-bar[style*="display: none"] {
        display: none !important;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Phase 3 补充: stock_import.html 页面级适配
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* 结果统计网格：2列 */
    .result-stats {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.5rem;
    }
    .result-card {
        padding: 0.85rem;
        border-radius: 10px;
    }
    .result-title {
        font-size: 0.88rem;
    }
    .stat-item {
        padding: 0.6rem;
        border-radius: 8px;
    }
    .stat-item .stat-value {
        font-size: 1.1rem;
    }
    .stat-item .stat-label {
        font-size: 0.7rem;
    }
    /* 日期快捷按钮 */
    .date-shortcuts {
        flex-wrap: wrap;
        gap: 0.35rem;
    }
    .date-shortcut {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }
    /* 进度条 */
    .progress-bar {
        height: 6px;
        border-radius: 3px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   Phase 4 补充: 全局收尾增强
   ═══════════════════════════════════════════════════════════════ */

/* ── 6.1 子页签页面的内容区域适配 ─────────────────────────── */
@media (max-width: 768px) {
    /* 有子页签时，确保 main 内容不被遮挡 */
    body.has-mobile-subtabs .main {
        padding-top: 0.5rem;
    }
    /* 有子页签时，页面标题缩小避免重复信息 */
    body.has-mobile-subtabs .page-title {
        font-size: 1rem;
        margin-bottom: 0.25rem;
    }
    body.has-mobile-subtabs .page-desc {
        font-size: 0.72rem;
        margin-bottom: 0.75rem;
    }
}

/* ── 6.2 全局 Design Token 应用增强 ──────────────────────── */
@media (max-width: 768px) {
    /* 使用 Design Token 的圆角 */
    .card,
    .section-card,
    .stat-card,
    .result-card {
        border-radius: var(--radius-md, 10px);
    }
    /* 使用 Design Token 的过渡 */
    .btn,
    .card,
    .tab-item,
    .quick-btn,
    .quick-tag,
    .filter-select,
    .form-input,
    .form-select {
        transition: all var(--transition-fast, 150ms ease);
    }
    /* 使用 Design Token 的字体 */
    .page-title {
        font-family: var(--font-display, -apple-system, 'PingFang SC', sans-serif);
    }
    /* 数值使用等宽字体 */
    .stat-value,
    .stat-val,
    .price,
    .stock-price {
        font-family: var(--font-mono, 'SF Mono', 'JetBrains Mono', monospace);
        font-variant-numeric: tabular-nums;
    }
}

/* ── 6.3 iOS 安全区增强 ──────────────────────────────────── */
@supports (padding: env(safe-area-inset-bottom)) {
    @media (max-width: 768px) {
        /* 底部操作栏安全区 */
        .action-bar-fixed,
        .bottom-actions {
            padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        }
        /* Modal 底部安全区 */
        .modal-footer {
            padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        }
    }
}

/* ── 6.4 暗色模式微调（增强对比度） ──────────────────────── */
@media (max-width: 768px) {
    /* 确保移动端文本可读性 */
    .page-desc,
    .form-hint,
    .stat-label,
    .filter-label {
        color: var(--color-text-secondary, var(--text-secondary, #94a3b8));
    }
    /* 输入框聚焦态增强 */
    .form-input:focus,
    .form-select:focus,
    .filter-select:focus {
        border-color: var(--color-accent-cyan, #06b6d4);
        box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
        outline: none;
    }
    /* 主按钮使用品牌渐变 */
    .btn-primary {
        background: var(--gradient-cyan, linear-gradient(135deg, #06B6D4, #22D3EE));
        border: none;
        color: #fff;
        font-weight: 600;
    }
    .btn-primary:active {
        filter: brightness(0.9);
        transform: scale(0.97);
    }
}
