/* ============================================================
   移动端适配样式（手机浏览器访问 PC Web 用）
   只在 ≤768px 屏幕生效，通过 link media="(max-width:768px)" 加载
   不污染 PC 端样式
   ============================================================ */

@media (max-width: 768px) {

    /* ---------- 基础 ---------- */
    html { -webkit-text-size-adjust: 100%; }
    body {
        font-size: 14px;
        padding-bottom: 24px;
    }

    /* ---------- 顶部 header ---------- */
    .header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px;
        padding: 12px 16px !important;
    }
    .header h1 { font-size: 17px !important; }
    .header p { font-size: 12px !important; }
    .header-right { width: 100%; justify-content: flex-start; }
    .header-right a { padding: 6px 12px !important; font-size: 12px !important; }

    /* ---------- 顶部导航 nav ---------- */
    .nav {
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }
    .nav a { font-size: 13px !important; padding: 5px 12px !important; }

    /* ---------- 容器 ---------- */
    .container {
        margin: 12px auto !important;
        padding: 0 12px !important;
    }

    /* ---------- 卡片 ---------- */
    .card {
        padding: 14px !important;
        border-radius: 10px !important;
        margin-bottom: 12px !important;
    }
    .card-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 8px;
    }
    .card-title { font-size: 15px !important; }

    /* ---------- 按钮 ---------- */
    .btn {
        padding: 8px 14px !important;
        font-size: 13px !important;
        min-height: 36px;
    }
    .btn-sm { padding: 6px 10px !important; font-size: 12px !important; }

    /* ---------- 搜索栏 ---------- */
    .search-bar {
        flex-direction: column !important;
        gap: 8px !important;
        margin-bottom: 12px !important;
    }
    .search-bar input, .search-bar select {
        width: 100% !important;
        padding: 10px 12px !important;
        font-size: 14px !important;
        min-height: 40px;
    }

    /* ---------- 表格：横向滚动 + 紧凑 ---------- */
    table { font-size: 13px; }
    th, td { padding: 8px 6px !important; word-break: break-word; }
    th { font-size: 12px !important; }
    td { font-size: 13px !important; }

    /* 把表格塞进可横向滚动的容器（页面里需要包一层 div.table-wrap） */
    .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -14px;        /* 抵消 card padding，让横向滚动条贴边 */
        padding: 0 14px;
    }
    .table-wrap table { min-width: 600px; }   /* 表格最少 600px，溢出可滚 */

    /* ---------- 统计 grid ---------- */
    .quick-grid, .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .quick-item { padding: 14px 6px !important; }
    .quick-icon { font-size: 22px !important; }
    .quick-label { font-size: 11px !important; }
    .stat-card { padding: 12px !important; }
    .stat-value { font-size: 18px !important; }
    .stat-label { font-size: 11px !important; }

    /* ---------- 列表项 ---------- */
    .list-item { flex-wrap: wrap; gap: 6px; padding: 10px 0 !important; }
    .list-title { font-size: 13px !important; }
    .list-sub { font-size: 11px !important; }

    /* ---------- 操作按钮组 ---------- */
    .actions {
        flex-wrap: wrap;
        gap: 4px !important;
    }
    .actions .btn { font-size: 12px !important; padding: 4px 8px !important; }

    /* ---------- 模态框：全屏化 ---------- */
    .modal-overlay { padding: 0; }
    .modal {
        width: 100% !important;
        max-width: none !important;
        height: 100vh;
        max-height: 100vh !important;
        border-radius: 0 !important;
        padding: 16px !important;
    }
    .modal-title { font-size: 16px !important; }
    .form-input, .form-label { font-size: 14px !important; }
    .form-input { padding: 12px !important; min-height: 44px; }
    .modal-footer {
        flex-direction: column-reverse !important;
        gap: 8px !important;
    }
    .modal-footer .btn {
        width: 100%;
        min-height: 44px;
    }

    /* ---------- Toast ---------- */
    .toast {
        font-size: 13px !important;
        padding: 10px 16px !important;
        max-width: 90%;
    }

    /* ---------- 工具：隐藏 ---------- */
    .hide-mobile { display: none !important; }
}

/* ---------- 极窄屏（手机横屏/小屏手机竖屏 ≤480px） ---------- */
@media (max-width: 480px) {
    .quick-grid, .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    th, td { padding: 6px 4px !important; }
    .btn { padding: 6px 10px !important; font-size: 12px !important; }
}
