/* ============================================
   移动端优化样式 - 力数出入库管理系统
   参考: rent.lexdata.cn 移动端设计
   ============================================ */

/* ============================================
   1. 基础响应式优化
   ============================================ */

/* 防止iOS缩放 */
@supports (-webkit-touch-callout: none) {
    input, textarea, select {
        font-size: 16px !important;
    }
}

/* 禁用双击缩放 */
* {
    touch-action: manipulation;
}

/* ============================================
   2. 侧边栏移动端优化
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        width: 260px;
        transform: translateX(-100%);
        box-shadow: 2px 0 12px rgba(0,0,0,0.15);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .sidebar-header {
        padding: 16px 0 12px;
    }
    .logo-row .logo {
        width: 48px;
        height: 48px;
    }
    .title-row .title {
        font-size: 13px;
    }
    .nav-item {
        padding: 12px 16px;
        font-size: 15px;
    }
    .nav-item .icon {
        font-size: 20px;
        width: 24px;
    }
    .sidebar-footer {
        padding: 10px 16px;
    }
}

/* ============================================
   3. 主内容区域优化
   ============================================ */
@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
        padding: 12px;
        min-height: 100vh;
    }
}

@media (max-width: 480px) {
    .main-content {
        /* 只用单边属性，不覆盖 768px 设置的 padding-bottom:70px */
        padding-top: 8px;
        padding-left: 8px;
        padding-right: 8px;
        max-width: 100vw;
        overflow-x: hidden;
    }
    .page-header {
        margin-bottom: 16px;
    }
    .page-header h1 {
        font-size: 17px;
    }
}

/* ============================================
   4. 顶部栏优化
   ============================================ */
@media (max-width: 768px) {
    .topbar {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        margin-bottom: 16px;
        padding: 0 4px;
    }
    .topbar > div {
        display: flex;
        align-items: center;
        flex: 1;
        justify-content: space-between;
    }
    .topbar h1 {
        font-size: 16px;
        margin: 0;
        order: 2;
    }
    .breadcrumb {
        display: none;
    }
    .hamburger-btn {
        display: inline-flex;
        width: 44px;
        height: 44px;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--text);
        border-radius: var(--radius);
        margin-right: 8px;
    }
    .hamburger-btn:hover {
        background: var(--bg);
    }
    .hamburger-btn svg {
        width: 24px;
        height: 24px;
    }
}

/* ============================================
   5. 工具栏优化
   ============================================ */
@media (max-width: 768px) {
    .toolbar {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        margin-bottom: 12px;
    }
    .toolbar-left, .toolbar-right {
        flex-direction: row;
        flex-wrap: nowrap;
        width: 100%;
        gap: 8px;
        align-items: center;
    }
    /* 只保留搜索框和查询按钮，其他筛选条件隐藏 */
    .toolbar-left .form-control:not(#searchInput):not([type="text"]):not([placeholder*="搜索"]) {
        display: none;
    }
    .toolbar-left input[type="date"] {
        display: none;
    }
    .toolbar-left select.form-control {
        display: none;
    }
    .toolbar-left .btn-secondary {
        display: none;
    }
    .toolbar .form-control {
        flex: 1;
        min-width: 0;
        width: auto;
        height: 36px;
        min-height: 36px;
        font-size: 14px;
        padding: 6px 10px;
    }
    .toolbar .btn {
        width: auto;
        min-width: 60px;
        height: 36px;
        min-height: 36px;
        padding: 0 14px;
        font-size: 14px;
    }
    .toolbar-right .btn {
        flex: 0 0 auto;
    }
}

@media (max-width: 480px) {
    .toolbar {
        gap: 8px;
    }
    .toolbar-left, .toolbar-right {
        gap: 6px;
    }
    .toolbar .form-control {
        min-width: 0;
        font-size: 14px;
        min-height: 36px;
        padding: 6px 10px;
    }
    .toolbar .btn {
        min-height: 36px;
        font-size: 14px;
        padding: 6px 14px;
    }
}

/* ============================================
   6. 卡片优化
   ============================================ */
@media (max-width: 768px) {
    .card {
        padding: 16px;
        margin-bottom: 12px;
        border-radius: var(--radius);
    }
    .card-header {
        margin-bottom: 12px;
    }
    .card-header h2 {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 12px;
        margin: 0 -8px 12px;
        border-radius: 0;
        box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    }
}

/* ============================================
   7. 统计卡片优化
   ============================================ */
@media (max-width: 768px) {
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 12px;
    }
    .stat-card {
        padding: 10px 12px;
        border-radius: 6px;
        gap: 8px;
    }
    .stat-card .stat-icon {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }
    .stat-card .stat-icon svg {
        width: 18px;
        height: 18px;
    }
    .stat-card .stat-info .stat-value {
        font-size: 18px;
    }
    .stat-card .stat-info .stat-label {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
    .stat-card {
        padding: 8px 10px;
    }
}

/* ============================================
   8. 表格移动端优化 - 列表式布局
   ============================================ */
@media (max-width: 768px) {
    .table-wrap {
        overflow-x: visible;
        -webkit-overflow-scrolling: touch;
    }
    table {
        font-size: 14px;
    }
    /* 表格转列表 */
    table, thead, tbody, th, td, tr {
        display: block;
    }
    thead {
        display: none;
    }
    tbody tr {
        display: flex;
        align-items: center;
        padding: 14px 12px;
        border-bottom: 1px solid var(--border);
        background: transparent;
        margin-bottom: 0;
        border-radius: 0;
        box-shadow: none;
    }
    tbody tr:first-child {
        border-top: 1px solid var(--border);
    }
    tbody tr:hover td {
        background: transparent;
    }

    /* 默认：第一列作为主内容区（左侧） */
    tbody td:first-child {
        flex: 1;
        min-width: 0;
        padding: 0;
        border: none;
    }
    /* 默认：其他列隐藏，但状态列显示 */
    tbody td:not(:first-child):not(:last-child):not([data-label="状态"]) {
        display: none;
    }
    /* 状态列显示 */
    tbody td[data-label="状态"] {
        display: flex !important;
        align-items: center;
        padding: 0 8px;
        border: none;
        flex-shrink: 0;
    }
    /* 操作列始终显示在右侧 */
    tbody td:last-child {
        display: flex;
        align-items: center;
        gap: 6px;
        padding: 0 0 0 12px;
        border: none;
        flex-shrink: 0;
    }
    tbody td:last-child .btn {
        min-height: 32px;
        padding: 4px 10px;
        font-size: 12px;
        white-space: nowrap;
    }

    /* 列表项主标题 */
    .mobile-list-title {
        font-size: 15px;
        font-weight: 600;
        color: var(--text);
        margin-bottom: 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        word-break: normal;
    }
    /* 列表项元信息（类型+状态） */
    .mobile-list-meta {
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .mobile-list-meta .tag {
        font-size: 11px;
        padding: 2px 6px;
        border-radius: var(--radius);
    }
    /* 列表项副标题 */
    .mobile-list-subtitle {
        font-size: 13px;
        color: var(--text-secondary);
        white-space: normal;
        overflow: visible;
        word-break: break-all;
    }

    /* === 产品管理页面：产品名称列作为主内容 === */
    tbody td[data-label="产品名称"] {
        display: block !important;
        flex: 1;
        min-width: 0;
        padding: 0;
        border: none;
    }
    /* 产品页面隐藏产品编码列（第一列），显示产品名称列 */
    table:has(td[data-label="产品名称"]) tbody td:first-child {
        display: none;
    }
    table:has(td[data-label="产品名称"]) tbody td[data-label="产品名称"] {
        display: block !important;
    }
    /* 产品页面操作按钮简化 - 只保留详情按钮 */
    table:has(td[data-label="产品名称"]) tbody td:last-child {
        flex-direction: column;
        gap: 4px;
        align-items: flex-end;
    }
    table:has(td[data-label="产品名称"]) tbody td:last-child .btn {
        min-height: 28px;
        padding: 2px 8px;
        font-size: 11px;
    }
    /* 隐藏编辑和删除按钮，只保留详情 */
    table:has(td[data-label="产品名称"]) tbody td:last-child .btn[style*="error"],
    table:has(td[data-label="产品名称"]) tbody td:last-child .btn:nth-child(2) {
        display: none;
    }

    /* === 入库/出库/盘点页面：单号列作为主内容 === */
    /* 这些页面第一列已经是单号，保持默认即可 */

    /* === 序列号页面：序列号列作为主内容，但显示产品信息 === */
    table:has(td[data-label="序列号"]) tbody td:first-child {
        display: none; /* 隐藏选择列 */
    }
    table:has(td[data-label="序列号"]) tbody td[data-label="序列号"] {
        display: block !important;
        flex: 1;
        min-width: 0;
        padding: 0;
        border: none;
    }
    table:has(td[data-label="序列号"]) tbody td[data-label="产品信息"] {
        display: none;
    }

    /* === 借测页面：借测单号列作为主内容 === */
    /* 第一列已经是借测单号，保持默认 */

    /* === 订单页面：订单号列作为主内容 === */
    /* 第一列已经是订单号，保持默认 */

    /* === 客户页面：客户名称列作为主内容 === */
    table:has(td[data-label="客户名称"]) tbody td:first-child {
        display: none; /* 隐藏客户编码 */
    }
    table:has(td[data-label="客户名称"]) tbody td[data-label="客户名称"] {
        display: block !important;
        flex: 1;
        min-width: 0;
        padding: 0;
        border: none;
    }

    /* === 仓库页面：仓库名称列作为主内容 === */
    table:has(td[data-label="仓库名称"]) tbody td:first-child {
        display: none; /* 隐藏仓库编码 */
    }
    table:has(td[data-label="仓库名称"]) tbody td[data-label="仓库名称"] {
        display: block !important;
        flex: 1;
        min-width: 0;
        padding: 0;
        border: none;
    }

    /* 状态标签在列表中的显示 */
    tbody td .tag,
    tbody td .status-tag {
        font-size: 12px;
        padding: 2px 8px;
    }

    /* === 入库/出库/盘点页面：参考租赁订单样式 === */
    table:has(td[data-label="入库单号"]) tbody tr,
    table:has(td[data-label="出库单号"]) tbody tr,
    table:has(td[data-label="盘点单号"]) tbody tr {
        flex-direction: row !important;
        align-items: center !important;
        padding: 12px 16px !important;
        gap: 0 !important;
        background: transparent !important;
        border: none !important;
        border-bottom: 1px solid var(--border) !important;
        border-radius: 0 !important;
        margin-bottom: 0 !important;
        box-shadow: none !important;
    }
    table:has(td[data-label="入库单号"]) tbody tr:first-child,
    table:has(td[data-label="出库单号"]) tbody tr:first-child,
    table:has(td[data-label="盘点单号"]) tbody tr:first-child {
        border-top: 1px solid var(--border) !important;
    }
    /* 第一列：单号信息，作为主内容 */
    table:has(td[data-label="入库单号"]) tbody td:first-child,
    table:has(td[data-label="出库单号"]) tbody td:first-child,
    table:has(td[data-label="盘点单号"]) tbody td:first-child {
        flex: 1 !important;
        min-width: 0 !important;
        padding: 0 !important;
        margin-bottom: 0 !important;
        border: none !important;
    }
    /* 显示状态列 */
    table:has(td[data-label="入库单号"]) tbody td[data-label="状态"],
    table:has(td[data-label="出库单号"]) tbody td[data-label="状态"],
    table:has(td[data-label="盘点单号"]) tbody td[data-label="状态"] {
        display: flex !important;
        align-items: center !important;
        padding: 0 8px !important;
        border: none !important;
        flex-shrink: 0 !important;
    }
    /* 隐藏类型、仓库、客户、日期等列 */
    table:has(td[data-label="入库单号"]) tbody td[data-label="类型"],
    table:has(td[data-label="入库单号"]) tbody td[data-label="仓库"],
    table:has(td[data-label="入库单号"]) tbody td[data-label="供应商/来源"],
    table:has(td[data-label="入库单号"]) tbody td[data-label="入库日期"],
    table:has(td[data-label="出库单号"]) tbody td[data-label="类型"],
    table:has(td[data-label="出库单号"]) tbody td[data-label="仓库"],
    table:has(td[data-label="出库单号"]) tbody td[data-label="客户"],
    table:has(td[data-label="出库单号"]) tbody td[data-label="出库日期"],
    table:has(td[data-label="盘点单号"]) tbody td[data-label="仓库"],
    table:has(td[data-label="盘点单号"]) tbody td[data-label="盘点日期"] {
        display: none !important;
    }
    /* 操作列：只显示详情按钮 */
    table:has(td[data-label="入库单号"]) tbody td:last-child,
    table:has(td[data-label="出库单号"]) tbody td:last-child,
    table:has(td[data-label="盘点单号"]) tbody td:last-child {
        display: flex !important;
        align-items: center !important;
        gap: 6px !important;
        padding: 0 0 0 12px !important;
        border: none !important;
        flex-shrink: 0 !important;
        width: auto !important;
        border-top: none !important;
        margin-top: 0 !important;
    }
    /* 隐藏审核、编辑、删除按钮，只保留详情 */
    table:has(td[data-label="入库单号"]) tbody td:last-child .btn-success,
    table:has(td[data-label="入库单号"]) tbody td:last-child .btn:nth-child(3),
    table:has(td[data-label="入库单号"]) tbody td:last-child .btn:nth-child(4),
    table:has(td[data-label="出库单号"]) tbody td:last-child .btn-success,
    table:has(td[data-label="出库单号"]) tbody td:last-child .btn:nth-child(3),
    table:has(td[data-label="出库单号"]) tbody td:last-child .btn:nth-child(4) {
        display: none !important;
    }
    /* 详情按钮样式 */
    table:has(td[data-label="入库单号"]) tbody td:last-child .btn,
    table:has(td[data-label="出库单号"]) tbody td:last-child .btn,
    table:has(td[data-label="盘点单号"]) tbody td:last-child .btn {
        min-height: 32px;
        padding: 4px 12px;
        font-size: 13px;
        white-space: nowrap;
        border: 1px solid var(--border);
        border-radius: 6px;
        background: #fff;
        color: var(--text-secondary);
        flex: none;
        max-width: none;
    }

/* ============================================
   9. 分页优化
   ============================================ */
@media (max-width: 768px) {
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
        gap: 4px;
    }
    .pagination button {
        min-width: 40px;
        height: 40px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .pagination button {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
    }
}

/* ============================================
   10. 按钮触控优化
   ============================================ */
@media (max-width: 768px) {
    .btn {
        min-height: 44px;
        padding: 10px 20px;
        font-size: 15px;
    }
    .btn-sm {
        min-height: 36px;
        padding: 6px 14px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    /* === 仓库库存页面移动端卡片样式 === */
    table:has(td[data-label="产品信息"]) tbody tr {
        flex-direction: row !important;
        align-items: stretch !important;
        padding: 12px 14px !important;
        gap: 0 !important;
        background: #fff !important;
        border: none !important;
        border-bottom: 1px solid var(--border) !important;
        border-radius: 0 !important;
        margin-bottom: 0 !important;
        box-shadow: none !important;
    }
    table:has(td[data-label="产品信息"]) tbody tr:first-child {
        border-top: 1px solid var(--border) !important;
    }
    /* 产品信息列：占主要空间 */
    table:has(td[data-label="产品信息"]) tbody td[data-label="产品信息"] {
        flex: 1 !important;
        min-width: 0 !important;
        padding: 0 !important;
        border: none !important;
    }
    .mobile-product-name {
        font-size: 15px;
        font-weight: 600;
        color: var(--text);
        margin-bottom: 8px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .mobile-product-name a {
        color: var(--primary);
        text-decoration: none;
    }
    .mobile-product-detail {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    .mobile-detail-row {
        display: flex;
        align-items: baseline;
        gap: 6px;
        font-size: 13px;
    }
    .mobile-detail-label {
        color: var(--text-muted);
        flex-shrink: 0;
        min-width: 32px;
    }
    .mobile-detail-value {
        color: var(--text-secondary);
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    /* 数量列：右对齐 */
    table:has(td[data-label="产品信息"]) tbody td.mobile-qty-col {
        display: flex !important;
        flex-direction: column;
        align-items: flex-end;
        justify-content: center;
        padding: 0 0 0 8px !important;
        border: none !important;
        flex-shrink: 0 !important;
        min-width: 50px;
        gap: 4px;
    }
    table:has(td[data-label="产品信息"]) tbody td.mobile-qty-col .qty-highlight {
        font-size: 15px;
        font-weight: 600;
    }
    /* 隐藏PC端表头 */
    table:has(td[data-label="产品信息"]) thead {
        display: none !important;
    }
}

@media (max-width: 480px) {
    .btn {
        width: 100%;
        min-height: 48px;
        font-size: 16px;
    }
    .btn-sm {
        min-height: 40px;
        font-size: 14px;
    }
    /* 工具栏按钮不要全宽，避免横向溢出 */
    .toolbar .btn,
    .toolbar-left .btn,
    .toolbar-right .btn {
        width: auto;
        flex: none;
        min-height: 44px;
        font-size: 14px;
        padding: 8px 14px;
        white-space: nowrap;
    }
}

/* ============================================
   11. 表单优化
   ============================================ */
@media (max-width: 768px) {
    .form-control {
        font-size: 16px;
        min-height: 48px;
        padding: 12px 14px;
    }
    select.form-control {
        padding-right: 36px;
    }
    textarea.form-control {
        min-height: 100px;
    }
    .form-group {
        margin-bottom: 16px;
    }
    .form-group label {
        font-size: 14px;
        margin-bottom: 8px;
    }
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
}

/* ============================================
   12. 弹窗移动端优化
   ============================================ */
@media (max-width: 768px) {
    .modal-overlay {
        align-items: flex-end;
        background: rgba(0,0,0,0.5);
    }
    .modal {
        width: 100%;
        max-width: 100%;
        max-height: 95vh;
        border-radius: var(--radius) var(--radius) 0 0;
        transform: translateY(100%);
    }
    .modal-overlay.active .modal {
        transform: translateY(0);
    }
    .modal-header {
        padding: 14px 16px;
    }
    .modal-header h3 {
        font-size: 17px;
    }
    .modal-body {
        padding: 16px;
        max-height: calc(95vh - 130px);
    }
    .modal-footer {
        padding: 12px 16px;
        flex-direction: column;
        gap: 8px;
    }
    .modal-footer .btn {
        width: 100%;
        min-height: 48px;
    }
    .modal-footer .btn + .btn {
        margin-left: 0;
    }
}

/* ============================================
   13. 搜索栏优化
   ============================================ */
@media (max-width: 768px) {
    .search-bar {
        flex-direction: row !important;
        gap: 8px;
        padding: 8px 16px;
    }
    .search-bar .form-group {
        width: auto;
        margin: 0;
        flex: 1;
    }
    .search-bar input {
        flex: 1;
        height: 36px;
        font-size: 14px;
    }
    /* 隐藏筛选条件，只保留搜索框 */
    .search-bar select,
    .search-bar .date-range,
    .search-bar input[type="date"] {
        display: none;
    }
    .search-bar .btn {
        width: auto;
        height: 36px;
        padding: 0 16px;
    }
    .search-bar .btn-secondary {
        display: none;
    }
}

/* ============================================
   14. 表格优化
   ============================================ */
@media (max-width: 768px) {
    .data-table {
        font-size: 13px;
    }
    .data-table th,
    .data-table td {
        padding: 8px 4px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100px;
    }
    /* 操作列按钮缩小 */
    .data-table .btn-sm {
        padding: 2px 6px;
        font-size: 12px;
    }
}

/* ============================================
   15. 列表项优化
   ============================================ */
@media (max-width: 768px) {
    .list-item {
        padding: 10px;
        font-size: 13px;
    }
    .list-item .title {
        font-size: 14px;
    }
    .list-item .subtitle {
        font-size: 12px;
    }
}

/* ============================================
   14. 消息提示优化
   ============================================ */
@media (max-width: 768px) {
    .toast-container {
        top: auto;
        bottom: 20px;
        left: 16px;
        right: 16px;
    }
    .toast {
        min-width: auto;
        width: 100%;
        font-size: 14px;
        padding: 14px 16px;
    }
}

/* ============================================
   15. 底部导航栏（已废弃，保留样式但默认隐藏）
   ============================================ */
.mobile-bottom-nav {
    display: none !important;
}

/* ============================================
   16. 快捷操作卡片优化
   ============================================ */
@media (max-width: 768px) {
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .quick-action-card {
        padding: 20px 12px;
    }
    .quick-action-card .icon {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .quick-actions {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    .quick-action-card {
        padding: 16px 12px;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        text-align: left;
    }
    .quick-action-card .icon {
        font-size: 24px;
        margin-bottom: 0;
    }
}

/* ============================================
   17. 详情页优化
   ============================================ */
@media (max-width: 768px) {
    .detail-section {
        margin-bottom: 16px;
    }
    .detail-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .detail-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .detail-label {
        font-size: 12px;
        color: var(--text-muted);
    }
    .detail-value {
        font-size: 14px;
    }
}

/* ============================================
   18. 标签和状态优化
   ============================================ */
@media (max-width: 480px) {
    .tag {
        padding: 3px 8px;
        font-size: 12px;
    }
    .status-tag {
        padding: 3px 8px;
        font-size: 12px;
    }
}

/* ============================================
   19. 下拉菜单优化
   ============================================ */
@media (max-width: 768px) {
    .dropdown-menu {
        min-width: 160px;
    }
    .dropdown-menu a {
        padding: 10px 16px;
        font-size: 14px;
    }
}

/* ============================================
   20. 步骤条优化
   ============================================ */
@media (max-width: 768px) {
    .steps {
        margin-bottom: 16px;
    }
    .step {
        font-size: 12px;
    }
    .step .step-num {
        width: 24px;
        height: 24px;
        font-size: 11px;
    }
    .step-divider {
        margin: 0 6px;
        max-width: 30px;
    }
}

/* ============================================
   21. 文件上传区域优化
   ============================================ */
@media (max-width: 768px) {
    .upload-area {
        padding: 24px;
    }
    .upload-area .upload-icon {
        font-size: 28px;
    }
}

/* ============================================
   22. 图表区域优化
   ============================================ */
@media (max-width: 768px) {
    .chart-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .chart-card {
        padding: 16px;
    }
    .chart-card h3 {
        font-size: 14px;
        margin-bottom: 12px;
    }
    .chart-container {
        height: 220px;
    }
    .chart-container.full-width {
        height: 260px;
    }
}

/* ============================================
   23. 设置页面优化
   ============================================ */
@media (max-width: 768px) {
    .settings-tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap;
        white-space: nowrap;
    }
    .settings-tab {
        padding: 10px 16px;
        font-size: 14px;
    }
    .info-row {
        flex-direction: column;
        gap: 4px;
    }
    .info-label {
        width: auto;
        font-size: 12px;
    }
    .settings-panel .card {
        max-width: 100%;
        box-sizing: border-box;
    }
}

/* ============================================
   24. 序列号列表优化
   ============================================ */
@media (max-width: 768px) {
    .serial-list {
        max-height: 250px;
    }
    .serial-list-item {
        padding: 12px;
        font-size: 14px;
    }
    .selected-serials .chip {
        padding: 4px 10px;
        font-size: 12px;
    }
}

/* ============================================
   25. 借测状态优化
   ============================================ */
@media (max-width: 480px) {
    .borrow-status {
        font-size: 12px;
    }
    .borrow-status::before {
        width: 6px;
        height: 6px;
    }
}

/* ============================================
   26. 联系人列表优化
   ============================================ */
@media (max-width: 768px) {
    .contact-list {
        max-height: 200px;
    }
    .contact-item {
        padding: 10px 0;
    }
    .contact-name {
        font-size: 14px;
    }
    .contact-detail {
        font-size: 12px;
    }
}

/* ============================================
   27. 日志详情优化
   ============================================ */
@media (max-width: 768px) {
    .log-detail {
        max-width: 200px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .log-detail {
        max-width: 120px;
    }
}

/* ============================================
   28. 库存表格优化
   ============================================ */
@media (max-width: 768px) {
    .stock-table th, .stock-table td {
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* ============================================
   29. 入库明细表格优化
   ============================================ */
@media (max-width: 768px) {
    .items-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .items-table th, .items-table td {
        padding: 8px;
        font-size: 12px;
        white-space: nowrap;
    }
}

/* ============================================
   30. 盘点表格优化
   ============================================ */
@media (max-width: 768px) {
    .check-items-table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .check-items-table th, .check-items-table td {
        padding: 8px;
        font-size: 12px;
        white-space: nowrap;
    }
}

/* ============================================
   31. 搜索选择下拉框优化
   ============================================ */
@media (max-width: 768px) {
    .search-select-dropdown {
        max-height: 250px;
    }
    .search-select-item {
        padding: 12px;
        font-size: 14px;
    }
}

/* ============================================
   32. 批次操作栏优化
   ============================================ */
@media (max-width: 768px) {
    .batch-bar {
        flex-wrap: wrap;
        padding: 10px 12px;
    }
    .batch-bar span {
        font-size: 13px;
    }
    .batch-bar .btn {
        min-height: 36px;
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* ============================================
   33. 空状态优化
   ============================================ */
@media (max-width: 768px) {
    .empty-state {
        padding: 40px 20px;
    }
    .empty-state svg {
        width: 48px;
        height: 48px;
    }
    .empty-state p {
        font-size: 13px;
    }
}

/* ============================================
   34. 加载状态优化
   ============================================ */
@media (max-width: 768px) {
    .loading {
        padding: 30px;
    }
    .spinner {
        width: 28px;
        height: 28px;
    }
}

/* ============================================
   35. 滚动条优化（移动端隐藏）
   ============================================ */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }
}

/* ============================================
   36. 安全区域适配（刘海屏）
   ============================================ */
@supports (padding-top: env(safe-area-inset-top)) {
    @media (max-width: 768px) {
        .main-content {
            padding-top: max(12px, env(safe-area-inset-top));
        }
    }
    @media (max-width: 480px) {
        .main-content {
            padding-top: max(8px, env(safe-area-inset-top));
        }
    }
}

/* ============================================
   37. 横屏模式优化
   ============================================ */
@media (max-width: 768px) and (orientation: landscape) {
    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }
    .modal {
        max-height: 90vh;
    }
    .modal-body {
        max-height: calc(90vh - 130px);
    }
}

/* ============================================
   38. 暗黑模式支持（可选）
   ============================================ */
@media (prefers-color-scheme: dark) {
    @media (max-width: 768px) {
    }
}

/* ============================================
   41. 产品管理页面移动端优化
   ============================================ */
@media (max-width: 768px) {
    /* 产品页面工具栏：搜索框+查询按钮单行 */
    .toolbar:has(#searchInput) {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }
    .toolbar:has(#searchInput) .toolbar-left {
        flex: 1;
        flex-wrap: nowrap;
        gap: 6px;
    }
    .toolbar:has(#searchInput) .toolbar-right {
        flex-shrink: 0;
        width: auto;
    }
    .toolbar:has(#searchInput) #searchInput {
        flex: 1;
        min-width: 0;
        font-size: 14px;
        min-height: 40px;
    }
    .toolbar:has(#searchInput) #statusFilter,
    .toolbar:has(#searchInput) .toolbar-left .btn:not(:first-child) {
        display: none;
    }
    .toolbar:has(#searchInput) .toolbar-left .btn:first-child {
        flex-shrink: 0;
        min-width: 60px;
        min-height: 40px;
        padding: 8px 12px;
        font-size: 14px;
    }
    .toolbar:has(#searchInput) .toolbar-right .btn {
        min-height: 40px;
        padding: 8px 14px;
        font-size: 14px;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .toolbar:has(#searchInput) {
        gap: 6px;
    }
    .toolbar:has(#searchInput) #searchInput {
        font-size: 15px;
        min-height: 44px;
    }
    .toolbar:has(#searchInput) .toolbar-left .btn:first-child {
        min-height: 44px;
        font-size: 14px;
    }
    .toolbar:has(#searchInput) .toolbar-right .btn {
        min-height: 44px;
        font-size: 13px;
        padding: 8px 10px;
        width: auto;
        flex: none;
        white-space: nowrap;
    }
}

/* ============================================
   39. 打印样式隐藏移动端元素
   ============================================ */
@media print {
    .hamburger-btn,
    .sidebar-overlay {
        display: none !important;
    }
}

/* ============================================
   40. 辅助功能 - 减少动画
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 桌面端隐藏，移动端显示 */
.desktop-only {
    display: table-cell;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
}

/* ============================================
   42. 详情弹窗移动端优化
   ============================================ */
@media (max-width: 768px) {
    /* 详情弹窗基本信息网格改为单列 */
    #detailModal .modal-body > div:first-child {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }
    
    /* 弹窗标题 */
    #detailModal h4 {
        font-size: 14px;
        margin-bottom: 12px;
    }
}
