/* ============================================
   移动端优化样式 - 全面优化版本
   注意：所有样式都包含在 @media (max-width: 768px) 中，确保不影响PC端显示
   ============================================ */

/* 全局移动端基础优化 - 仅在移动端生效 */
@media screen and (max-width: 768px) {
    /* 根元素优化 */
    html {
        font-size: 14px;
    }
    
    body {
        font-size: 14px;
        line-height: 1.6;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* 容器优化 - 统一间距 */
    .container-fluid, .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
        max-width: 100% !important;
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box;
    }
    
    /* ========== 导航栏优化 ========== */
    .navbar {
        min-height: 60px;
        padding: calc(0.45rem + env(safe-area-inset-top, 0px)) 0.75rem 0.45rem;
        box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    }
    
    .navbar-brand {
        padding: 0.5rem 0;
        margin-right: 0.5rem;
    }
    
    .navbar-brand .brand-content {
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
    }

    .navbar-brand .brand-mark {
        width: 28px !important;
        height: 28px !important;
        border-radius: 6px;
    }

    .navbar-brand .brand-text-stack {
        display: flex;
        flex-direction: column;
        gap: 0.05rem;
    }
    
    .brand-text-main {
        font-size: 1.02rem !important;
        font-weight: 800;
        line-height: 1.2;
    }
    
    .brand-text-sub {
        font-size: 0.7rem !important;
        line-height: 1.2;
        opacity: 0.9;
    }
    
    /* 时间显示隐藏 */
    .time-display-container {
        display: none !important;
    }
    
    .navbar-text {
        display: none !important;
    }
    
    /* 导航栏右侧容器优化。
       .navbar-nav 在 lg 断点以下是 flex-direction:column，会把铃铛/退出按钮竖着排成两行，
       白白吃掉一行顶栏高度，这里强制回到横排 */
    .navbar-nav.ms-auto,
    .app-header-actions {
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        gap: 0.25rem;
        margin-left: auto;
    }
    
    .navbar-nav.ms-auto .btn,
    .navbar-nav.ms-auto .btn-header-outline {
        flex-shrink: 0;
        padding: 0.45rem 0.65rem;
        font-size: 0.8rem;
        min-width: 44px;
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
        border-radius: 14px;
    }
    
    .navbar-nav.ms-auto .btn i,
    .navbar-nav.ms-auto .btn-header-outline i {
        margin-right: 0;
        font-size: 0.9em;
    }
    
    .navbar-nav.ms-auto .btn .d-none {
        display: none !important;
    }
    
    /* 确保导航栏不换行 */
    .navbar .container-fluid {
        flex-wrap: nowrap;
        overflow: hidden;
        gap: 0.45rem;
    }
    
    /* 导航栏品牌区域优化 */
    .navbar-brand {
        flex-shrink: 1;
        min-width: 0;
        overflow: hidden;
    }
    
    /* 导航按钮 */
    .navbar-toggler,
    .app-menu-button {
        padding: 0.4rem 0.6rem;
        font-size: 1rem;
        border: none;
        min-width: 44px;
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* ========== 侧边栏优化 - 抽屉式 ========== */
    body.sidebar-open {
        overflow: hidden;
        overscroll-behavior: none;
    }

    .sidebar {
        position: fixed !important;
        left: calc(-1 * min(78vw, 252px)) !important;
        top: calc(60px + env(safe-area-inset-top, 0px)) !important;
        height: calc(100dvh - 60px - env(safe-area-inset-top, 0px)) !important;
        width: min(78vw, 252px) !important;
        min-width: 0 !important;
        z-index: 1050 !important;
        padding: 0.75rem 0 0.75rem max(0.75rem, env(safe-area-inset-left, 0px)) !important;
        transition: left 0.28s cubic-bezier(0.32, 0.72, 0, 1) !important;
        background: transparent !important;
        box-shadow: none !important;
        overflow: visible !important;
        border-right: none !important;
    }
    
    .sidebar.show {
        left: 0 !important;
    }
    
    .sidebar.toggled {
        width: min(78vw, 252px) !important;
    }

    .sidebar .p-3 {
        position: static !important;
        width: 100% !important;
        height: 100% !important;
        padding: 0.75rem !important;
        background: rgba(255, 255, 255, 0.98) !important;
        border: 1px solid rgba(226, 232, 240, 0.95) !important;
        border-left: none !important;
        border-radius: 0 24px 24px 0 !important;
        box-shadow: 18px 0 48px rgba(15, 23, 42, 0.18) !important;
        overflow-x: hidden !important;
        overflow-y: auto !important;
        scrollbar-width: none;
        -ms-overflow-style: none;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .sidebar .p-3::-webkit-scrollbar {
        width: 0;
        height: 0;
        display: none;
    }
    
    .sidebar .sidebar-text {
        display: inline-block !important;
        max-width: 136px !important;
        opacity: 1 !important;
        font-size: 0.9rem;
        font-weight: 600;
    }
    
    .sidebar .sidebar-icon {
        margin-right: 0.55rem !important;
        font-size: 1.1rem;
        width: 24px !important;
        text-align: center;
    }
    
    .sidebar .nav-link {
        justify-content: flex-start !important;
        padding: 0.78rem 0.75rem !important;
        margin-bottom: 0.35rem;
        border-radius: 14px !important;
        min-height: 50px;
        display: flex;
        align-items: center;
        color: #475569 !important;
        transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
        touch-action: manipulation;
    }
    
    .sidebar .nav-link:hover,
    .sidebar .nav-link:active {
        background-color: #eff6ff !important;
        color: #2563eb !important;
    }
    
    .sidebar .nav-link.bg-primary {
        background: linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(59, 130, 246, 0.08)) !important;
        color: #1d4ed8 !important;
        box-shadow: inset 3px 0 0 #2563eb, 0 6px 18px rgba(37, 99, 235, 0.10) !important;
    }

    .sidebar-indicator {
        display: none !important;
    }
    
    /* 侧边栏遮罩 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: calc(60px + env(safe-area-inset-top, 0px));
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(15, 23, 42, 0.48);
        z-index: 1040;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        opacity: 0;
        transition: opacity 0.22s ease;
    }
    
    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }
    
    /* ========== 主内容区域优化 ========== */
    .app-body {
        display: block !important; /* 覆盖base.html中的flex布局 */
        margin-left: 0 !important;
        padding-top: 0 !important;
        box-sizing: border-box;
        width: 100% !important;
    }
    
    .content-wrapper {
        display: block !important; /* 覆盖base.html中的flex布局 */
        margin-left: 0 !important;
        padding: 1rem 0.75rem !important;
        width: 100% !important;
        min-height: calc(100vh - 56px);
        box-sizing: border-box;
        flex: none !important; /* 移除flex属性 */
        background-color: transparent !important; /* 移除背景色 */
        overflow-y: visible !important; /* 移除滚动限制 */
    }
    
    .content-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1rem !important;
        margin: 0 !important;
        box-sizing: border-box;
        background-color: transparent !important; /* 移除背景色 */
        border-radius: 0 !important; /* 移除圆角 */
        box-shadow: none !important; /* 移除阴影 */
        min-height: auto !important;
        /* 不能用 overflow-x:hidden：超宽子模块会被直接裁掉且无法滚动，右侧内容彻底不可见。
           改为允许内部 grid/flex 正确收缩，超宽表格各自用滚动容器承接 */
        min-width: 0;
    }
    
    /* 确保所有容器不超出屏幕 */
    .row {
        margin-left: -0.5rem !important;
        margin-right: -0.5rem !important;
    }
    
    .row > * {
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
    }
    
    /* ========== 标题优化 - 统一风格 ========== */
    h1 {
        font-size: 1.4rem;
        font-weight: 600;
        margin-top: 1rem !important;
        margin-bottom: 1.25rem !important;
        line-height: 1.3;
        color: #2c3e50;
    }
    
    h2 {
        font-size: 1.25rem;
        font-weight: 600;
        margin-top: 1rem;
        margin-bottom: 1rem;
        line-height: 1.3;
    }
    
    h3 {
        font-size: 1.1rem;
        font-weight: 600;
        margin-top: 0.75rem;
        margin-bottom: 0.75rem;
        line-height: 1.3;
    }
    
    h4 {
        font-size: 1rem;
        font-weight: 600;
    }
    
    /* ========== 卡片优化 - 统一设计 ========== */
    .card {
        margin-bottom: 1rem;
        border-radius: 12px;
        border: 1px solid #e9ecef;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        overflow: hidden;
        transition: box-shadow 0.2s ease;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .card:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .card-body {
        padding: 1.25rem !important;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .card-header {
        padding: 1rem 1.25rem !important;
        background-color: #f8f9fa;
        border-bottom: 1px solid #e9ecef;
        font-weight: 600;
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .card-footer {
        padding: 0.75rem 1.25rem !important;
        background-color: #f8f9fa;
        border-top: 1px solid #e9ecef;
    }
    
    /* 卡片内表格容器优化 */
    .card .table-responsive {
        margin: -1.25rem;
        padding: 1.25rem;
    }
    
    .desktop-table {
        display: block;
    }
    
    .mobile-card-list {
        display: none;
    }
    
    /* Dashboard主页面专项优化 */
    .dashboard-page h1 small {
        display: block;
        margin-left: 0;
        margin-top: 0.35rem;
        font-size: 0.75rem;
    }
    
    .stat-card-row {
        row-gap: 0.75rem !important;
    }
    
    .stat-card-row > [class*="col-"] {
        padding-left: 0.35rem !important;
        padding-right: 0.35rem !important;
    }
    
    .stat-card-module {
        min-height: 130px;
        border-radius: 14px;
    }
    
    .search-type-grid {
        row-gap: 0.5rem !important;
    }
    
    .search-type-grid > [class*="col-"] {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    .search-type-grid .search-type-btn {
        font-size: 0.85rem;
        padding: 0.65rem 0.5rem;
    }
    
    .search-inputs-container .input-group-lg .form-control,
    .search-inputs-container .input-group-lg .input-group-text {
        font-size: 0.95rem;
    }
    
    .search-action-bar {
        flex-direction: column !important;
        gap: 0.75rem !important;
    }
    
    .search-action-bar .btn {
        width: 100%;
    }
    
    .quick-action-grid {
        row-gap: 0.75rem !important;
    }
    
    .quick-action-grid > [class*="col-"] {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    @media screen and (max-width: 420px) {
        .quick-action-grid > [class*="col-"] {
            flex: 0 0 100%;
            max-width: 100%;
        }
        
        .search-type-grid > [class*="col-"] {
            flex: 0 0 100%;
            max-width: 100%;
        }
    }
    
    /* ========== 按钮优化 - 触摸友好 ========== */
    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
        font-weight: 500;
        min-height: 44px;
        min-width: 44px;
        border-radius: 8px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
        transition: all 0.2s ease;
        line-height: 1.5;
        white-space: nowrap;
    }
    
    .btn i {
        font-size: 0.95em;
    }
    
    .btn-sm {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        min-height: 40px;
        min-width: 40px;
        font-weight: 500;
    }
    
    /* 表格中的小按钮进一步优化 */
    table .btn-sm {
        padding: 0.45rem 0.65rem;
        font-size: 0.75rem;
        min-height: 38px;
    }
    
    .btn-lg {
        padding: 1rem 1.75rem;
        font-size: 1rem;
        min-height: 48px;
        min-width: 48px;
        font-weight: 600;
    }
    
    .btn-icon-split {
        flex-direction: row;
        align-items: center;
        width: 100%;
        justify-content: flex-start;
    }
    
    .btn-icon-split .icon {
        padding: 0.5rem;
        margin-right: 0.5rem;
        flex-shrink: 0;
    }
    
    .btn-icon-split .text {
        flex: 1;
        text-align: left;
    }
    
    /* 按钮组优化 */
    .btn-group {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin: 0;
    }
    
    /* 工单详情页面顶部按钮组优化 */
    .action-buttons-container {
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }
    
    .action-buttons-container .btn-icon-split,
    .action-buttons-container .btn {
        width: 100%;
        margin: 0 !important;
    }
    
    /* PC端保持水平排列 */
    @media (min-width: 769px) {
        .action-buttons-container {
            flex-direction: row;
            flex-wrap: wrap;
        }
        
        .action-buttons-container .btn-icon-split,
        .action-buttons-container .btn {
            width: auto;
            margin-right: 0.5rem !important;
        }
    }
    
    /* 表格操作列按钮优化 */
    table td .btn,
    table td .btn-group {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    table td .btn:last-child,
    table td .btn-group:last-child {
        margin-bottom: 0;
    }
    
    /* 操作列特殊处理 - 工单列表两列布局，其他表格垂直排列 */
    .table tbody td:last-child:has(.btn) {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
        padding: 0.75rem !important;
    }
    
    /* 其他表格的操作列保持垂直排列 */
    table td:has(.btn):not(.table tbody td:last-child) {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 1rem 0.75rem !important;
    }
    
    /* 工单列表页面操作按钮优化 */
    .dataTable td:last-child {
        min-width: 120px;
    }
    
    .dataTable td:last-child .btn {
        flex: 1 1 calc(50% - 0.25rem) !important;
        min-width: calc(50% - 0.25rem) !important;
        max-width: calc(50% - 0.25rem) !important;
        margin: 0 !important;
        margin-bottom: 0 !important;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 表格操作列按钮容器 */
    table td .btn-group-vertical {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    /* 新建工单按钮优化 */
    .btn-lg.text-white {
        width: 100%;
        margin-bottom: 1rem;
    }
    
    /* 所有按钮在移动端全宽显示 */
    .container-fluid .btn:not(.btn-sm):not(.btn-group .btn) {
        width: 100%;
        margin-bottom: 0.75rem;
    }
    
    .container-fluid .btn:not(.btn-sm):not(.btn-group .btn):last-child {
        margin-bottom: 0;
    }
    
    /* 工单列表表格操作列优化 - 两列布局 */
    .table tbody td:last-child {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        align-items: stretch !important;
        gap: 0.5rem !important;
        padding: 0.75rem !important;
    }
    
    .table tbody td:last-child .btn {
        flex: 1 1 calc(50% - 0.25rem) !important;
        min-width: calc(50% - 0.25rem) !important;
        max-width: calc(50% - 0.25rem) !important;
        margin: 0 !important;
        min-height: 40px;
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8rem !important;
    }
    
    /* 卡片式列表（移动端） */
    .desktop-table {
        display: none !important;
    }
    
    .mobile-card-list {
        display: flex;
        flex-direction: column;
        gap: 0.85rem;
        margin-top: 0.5rem;
    }
    
    .mobile-card {
        background: #ffffff;
        border-radius: 16px;
        padding: 1rem 1.1rem;
        box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
        border: 1px solid rgba(15, 23, 42, 0.05);
        border-left: 4px solid #e2e8f0;
    }
    
    .mobile-card.overdue {
        border-left-color: #ef4444 !important;
    }
    
    .mobile-card.due-soon {
        border-left-color: #f97316 !important;
    }
    
    .mobile-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 0.75rem;
        margin-bottom: 0.85rem;
    }
    
    .mobile-card-header .label {
        display: block;
        font-size: 0.75rem;
        color: #94a3b8;
        letter-spacing: 0.05em;
        text-transform: uppercase;
    }
    
    .mobile-card-header .value {
        font-size: 1.05rem;
        font-weight: 600;
        color: #0f172a;
        margin-top: 0.1rem;
    }
    
    .price-tag {
        font-size: 1rem;
        font-weight: 700;
        color: #dc2626;
    }
    
    .mobile-card-body {
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
    }
    
    .mobile-meta {
        display: flex;
        justify-content: space-between;
        gap: 0.75rem;
        font-size: 0.95rem;
        line-height: 1.4;
    }
    
    .mobile-meta span {
        color: #94a3b8;
        min-width: 70px;
    }
    
    .mobile-meta strong {
        color: #0f172a;
        font-weight: 600;
        text-align: right;
    }
    
    .mobile-meta-stack {
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
        align-items: flex-end;
    }
    
    .mobile-card-actions {
        margin-top: 0.85rem;
    }
    
    .mobile-card-actions .btn {
        border-radius: 10px;
        font-weight: 600;
    }
    
    .status-badge {
        padding: 0.2rem 0.65rem;
        border-radius: 999px;
        font-size: 0.75rem;
        font-weight: 600;
        color: #fff;
        white-space: nowrap;
    }
    
    .status-primary { background: linear-gradient(135deg, #2563eb, #2563eb); }
    .status-info { background: linear-gradient(135deg, #0ea5e9, #0284c7); }
    .status-warning { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #1f2937; }
    .status-success { background: linear-gradient(135deg, #22c55e, #16a34a); }
    .status-muted { background: #94a3b8; }
    .status-default { background: #6b7280; }
    .status-danger { background: linear-gradient(135deg, #ef4444, #dc2626); }
    
    .pending-orders-mobile .mobile-card {
        border-left: 4px solid #2563eb;
    }
    
    .order-mobile-list .mobile-card {
        border-left: 4px solid #0ea5e9;
    }
    
    .appointment-mobile-list .mobile-card {
        border-left: 4px solid #14b8a6;
    }
    
    .todo-mobile-list .mobile-card {
        border-left: 4px solid #f97316;
    }
    
    .price-mobile-list .mobile-card {
        border-left: 4px solid #0ea5e9;
    }
    
    .customer-top-mobile-list .mobile-card {
        border-left: 4px solid #f59e0b;
    }
    
    .customer-orders-mobile .mobile-card {
        border-left: 4px solid #2563eb;
    }
    
    /* 确保按钮图标和文字在一行 */
    .table tbody td:last-child .btn i {
        margin-right: 0.25rem;
        font-size: 0.85em;
    }
    
    /* PC端恢复按钮原始样式 */
    @media (min-width: 769px) {
        .container-fluid .btn:not(.btn-sm):not(.btn-group .btn) {
            width: auto;
            margin-bottom: 0;
        }
        
        table td:has(.btn) {
            display: table-cell;
            padding: 0.75rem !important;
        }
        
        table td .btn {
            width: auto;
            margin: 0 0.25rem;
        }
        
        .dataTable td:last-child {
            display: table-cell !important;
        }
        
        .dataTable td:last-child .btn {
            width: auto !important;
            margin: 0 0.25rem !important;
        }
        
        .table tbody td:last-child {
            display: table-cell !important;
            padding: 0.75rem !important;
        }
        
        .table tbody td:last-child .btn {
            width: auto !important;
            margin: 0 0.25rem !important;
        }
    }
    
    /* ========== 表单优化 ========== */
    .form-control, .form-select {
        font-size: 16px; /* 防止iOS自动缩放 */
        padding: 0.75rem 1rem;
        min-height: 44px;
        border-radius: 8px;
        border: 1px solid #ced4da;
        transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    }
    
    .form-control:focus, .form-select:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
    }
    
    .form-label {
        font-size: 0.9rem;
        font-weight: 500;
        margin-bottom: 0.5rem;
        color: #495057;
    }
    
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    .input-group {
        margin-bottom: 1.25rem;
    }
    
    .input-group-text {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
        min-height: 44px;
    }
    
    /* 表单校验提示 */
    .invalid-feedback {
        font-size: 0.85rem;
        margin-top: 0.25rem;
    }
    
    .valid-feedback {
        font-size: 0.85rem;
        margin-top: 0.25rem;
    }
    
    /* ========== 表格优化 - 移动端卡片式 ========== */
    .table-responsive {
        border: none;
        margin-bottom: 1rem;
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 0.875rem;
        margin-bottom: 0;
        width: 100%;
        min-width: 600px; /* 确保表格最小宽度，避免过度压缩 */
    }
    
    /* 表格头部优化 */
    .table thead th {
        font-size: 0.8rem;
        font-weight: 600;
        padding: 0.75rem 0.5rem;
        white-space: nowrap;
        background-color: #f8f9fa;
        border-bottom: 2px solid #dee2e6;
    }
    
    /* 表格单元格优化 */
    .table tbody td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
        vertical-align: middle;
        word-break: break-word;
    }
    
    /* 表格行优化 */
    .table tbody tr {
        border-bottom: 1px solid #e9ecef;
    }
    
    .table tbody tr:hover {
        background-color: #f8f9fa;
    }
    
    /* 移动端表格卡片式布局 */
    .table-mobile-card thead {
        display: none;
    }
    
    .table-mobile-card tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 12px;
        padding: 1rem;
        background: white;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
        transition: box-shadow 0.2s ease;
    }
    
    .table-mobile-card tbody tr:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }
    
    .table-mobile-card tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 0;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        text-align: left !important;
    }
    
    .table-mobile-card tbody td:last-child {
        border-bottom: none;
    }
    
    .table-mobile-card tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        margin-right: 1rem;
        flex-shrink: 0;
        min-width: 80px;
        font-size: 0.85rem;
    }
    
    /* 操作列特殊处理 */
    .table-mobile-card tbody td[data-label*="操作"],
    .table-mobile-card tbody td[data-label*="操作"] {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding-top: 1rem;
    }
    
    .table-mobile-card tbody td[data-label*="操作"] .btn,
    .table-mobile-card tbody td[data-label*="操作"] .btn {
        width: 100%;
        margin: 0;
    }
    
    /* DataTables 移动端优化 */
    .dataTables_wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .dataTables_wrapper .dataTables_length,
    .dataTables_wrapper .dataTables_filter {
        margin-bottom: 1rem;
    }
    
    .dataTables_wrapper .dataTables_length select,
    .dataTables_wrapper .dataTables_filter input {
        font-size: 0.9rem;
        padding: 0.5rem;
        min-height: 40px;
    }
    
    .dataTables_wrapper .dataTables_paginate {
        margin-top: 1rem;
        text-align: center;
    }
    
    .dataTables_wrapper .dataTables_paginate .paginate_button {
        padding: 0.5rem 0.75rem;
        min-width: 40px;
        min-height: 40px;
        margin: 0 0.25rem;
    }
    
    /* ========== 统计卡片优化 ========== */
    .stat-card {
        margin-bottom: 1rem;
    }
    
    .stat-number {
        font-size: 2.25rem !important;
        font-weight: 700;
        line-height: 1.2;
    }
    
    .stat-title {
        font-size: 0.95rem !important;
        font-weight: 500;
        opacity: 0.9;
    }
    
    /* ========== 警告框优化 ========== */
    .alert {
        border-radius: 10px;
        padding: 1rem 1.25rem;
        margin-bottom: 1rem;
        border: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }
    
    .alert-heading {
        font-size: 1rem;
        font-weight: 600;
        margin-bottom: 0.5rem;
    }
    
    .alert p {
        margin-bottom: 0.5rem;
        font-size: 0.9rem;
        line-height: 1.6;
    }
    
    .alert p:last-child {
        margin-bottom: 0;
    }
    
    /* ========== 搜索表单优化 ========== */
    .search-form .row {
        margin: 0;
        gap: 0.75rem;
    }
    
    .search-form .col-md-4,
    .search-form .col-md-6,
    .search-form .col-md-2,
    .search-form .col-md-3 {
        padding: 0;
        margin-bottom: 0.75rem;
    }
    
    .search-form .btn {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    /* ========== 模态框优化 ========== */
    .modal-dialog {
        margin: 0.75rem;
        max-width: calc(100% - 1.5rem);
    }
    
    .modal-content {
        border-radius: 12px;
        border: none;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    }
    
    .modal-header {
        padding: 1.25rem 1.5rem;
        border-bottom: 1px solid #e9ecef;
        border-radius: 12px 12px 0 0;
    }
    
    .modal-title {
        font-size: 1.1rem;
        font-weight: 600;
    }
    
    .modal-body {
        padding: 1.5rem;
        max-height: calc(100vh - 220px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .modal-footer {
        padding: 1rem 1.5rem;
        flex-direction: column;
        gap: 0.5rem;
        border-top: 1px solid #e9ecef;
        border-radius: 0 0 12px 12px;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 0;
    }
    
    /* ========== 列表优化 ========== */
    .list-group-item {
        padding: 1rem;
        margin-bottom: 0.5rem;
        border-radius: 10px;
        border: 1px solid #e9ecef;
        transition: all 0.2s ease;
    }
    
    .list-group-item:hover {
        background-color: #f8f9fa;
        border-color: #dee2e6;
    }
    
    /* ========== 标签和徽章优化 ========== */
    .badge {
        padding: 0.4rem 0.75rem;
        font-size: 0.8rem;
        font-weight: 500;
        border-radius: 6px;
    }
    
    /* ========== 分页优化 ========== */
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .page-link {
        padding: 0.5rem 0.75rem;
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        font-size: 0.9rem;
    }
    
    /* ========== Toast通知优化 ========== */
    .toast-container {
        left: 0.75rem !important;
        right: 0.75rem !important;
        top: 70px !important;
        max-width: calc(100% - 1.5rem);
        z-index: 1060;
    }
    
    .toast {
        min-width: 100%;
        margin-bottom: 0.75rem;
        border-radius: 10px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    /* ========== 快速操作按钮优化 ========== */
    .quick-action-btn {
        margin-bottom: 1rem;
        padding: 1rem;
        border-radius: 12px;
        transition: all 0.2s ease;
    }
    
    .quick-action-icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }
    
    .quick-action-text {
        font-size: 0.85rem;
        margin-top: 0.5rem;
        font-weight: 500;
    }
    
    /* ========== 时间线优化 ========== */
    .timeline-container-horizontal {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1rem 0;
    }
    
    /* ========== 其他组件优化 ========== */
    /* ========== 设备验机结果卡片优化 - 移动端 ========== */
    .check-results-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)) !important;
        gap: 0.5rem !important;
        padding: 1rem !important;
    }
    
    .check-result-card {
        min-width: 110px !important;
        min-height: 110px !important;
        padding: 0.875rem 0.625rem !important;
        border-radius: 12px !important;
        aspect-ratio: 1 !important;
    }
    
    .check-result-icon {
        width: 44px !important;
        height: 44px !important;
        font-size: 24px !important;
        margin-bottom: 0.3rem !important;
        border-radius: 8px !important;
    }
    
    .check-result-label {
        font-size: 13px !important;
        margin-bottom: 0.3rem !important;
        font-weight: 600 !important;
    }
    
    .check-badge {
        font-size: 12px !important;
        padding: 0.25rem 0.6rem !important;
        font-weight: 700 !important;
    }
    
    /* 小屏幕进一步优化 */
    @media screen and (max-width: 400px) {
        .check-results-grid {
            grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important;
            gap: 0.4rem !important;
        }
        
        .check-result-card {
            width: 100px !important;
            height: 100px !important;
            padding: 0.75rem 0.5rem !important;
            border-radius: 10px !important;
        }
        
        .check-result-icon {
            font-size: 22px !important;
            margin-bottom: 0.25rem !important;
        }
        
        .check-result-label {
            font-size: 12px !important;
            margin-bottom: 0.25rem !important;
        }
        
        .check-badge {
            font-size: 11px !important;
            padding: 0.2rem 0.5rem !important;
        }
    }
    
    /* ========== 步骤条优化 - 移动端 ========== */
    .stepper-timeline {
        padding: 0.75rem 0;
        gap: 0;
        align-items: center !important;
    }
    
    .stepper-step {
        width: 160px !important;
        height: 160px !important;
        max-width: 160px !important;
        min-width: 160px !important;
        padding: 1.25rem 1rem !important;
        border-radius: 12px !important;
        margin-bottom: 0.625rem !important;
        margin-right: 0 !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .stepper-step:last-child {
        margin-bottom: 0 !important;
    }
    
    .stepper-step .step-bg-number {
        font-size: 100px !important;
        opacity: 0.08 !important;
    }
    
    .stepper-step .step-content {
        text-align: center !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.5rem !important;
        height: 100% !important;
    }
    
    .stepper-step .step-title {
        font-size: 17px !important;
        justify-content: center !important;
        text-align: center !important;
        color: #ffffff !important;
        margin-bottom: 0 !important;
    }
    
    .stepper-step .step-title i {
        font-size: 15px !important;
    }
    
    .stepper-step .step-time {
        font-size: 13px !important;
        margin-bottom: 0 !important;
        color: rgba(255, 255, 255, 0.9) !important;
    }
    
    .stepper-step .step-time span {
        color: rgba(255, 255, 255, 0.7) !important;
    }
    
    .stepper-step .step-meta {
        font-size: 11px !important;
        margin-top: 0.25rem !important;
        padding-top: 0.5rem !important;
        text-align: center !important;
        color: rgba(255, 255, 255, 0.85) !important;
        border-top-color: rgba(255, 255, 255, 0.2) !important;
    }
    
    .stepper-step .step-meta span {
        color: rgba(255, 255, 255, 0.85) !important;
    }
    
    .stepper-step::after {
        top: auto !important;
        bottom: -0.625rem !important;
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        width: 3px !important;
        height: 0.625rem !important;
        background: rgba(255, 255, 255, 0.3) !important;
        border-radius: 2px !important;
    }
    
    .stepper-step:last-child::after {
        display: none !important;
    }
    
    @media screen and (max-width: 576px) {
        .stepper-step {
            width: 140px !important;
            height: 140px !important;
            max-width: 140px !important;
            min-width: 140px !important;
            padding: 1rem 0.875rem !important;
        }
        
        .stepper-step .step-bg-number {
            font-size: 90px !important;
        }
        
        .stepper-step .step-title {
            font-size: 16px !important;
        }
        
        .stepper-step .step-title i {
            font-size: 14px !important;
        }
        
        .stepper-step .step-time {
            font-size: 12px !important;
        }
        
        .stepper-step .step-meta {
            font-size: 10px !important;
        }
    }
    
    /* 分隔线 */
    hr {
        margin: 1.5rem 0;
        border-color: #e9ecef;
    }
    
    /* 文本 */
    .text-muted {
        font-size: 0.85rem;
}

    /* 代码块 */
    code {
        font-size: 0.85rem;
        padding: 0.2rem 0.4rem;
        border-radius: 4px;
    }
    
    pre {
        font-size: 0.85rem;
        padding: 1rem;
        border-radius: 8px;
    }
    
    /* 图片响应式 */
    img {
        max-width: 100%;
        height: auto;
    }
    
    /* 响应式嵌入 */
    .embed-responsive {
        margin-bottom: 1rem;
    }
}

/* ========== 小屏幕手机优化 (≤576px) ========== */
@media screen and (max-width: 576px) {
    html {
        font-size: 13px;
    }
    
    /* 更紧凑的间距 */
    .container-fluid, .container {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .content-wrapper {
        padding: 0.75rem 0.5rem;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    .card-header {
        padding: 0.875rem 1rem !important;
        font-size: 0.95rem;
    }
    
    /* 标题进一步缩小 */
    h1 {
        font-size: 1.25rem;
        margin-bottom: 1rem !important;
    }
    
    h2 {
        font-size: 1.15rem;
    }
    
    h3 {
        font-size: 1rem;
    }
    
    /* 按钮组优化 */
    .btn-group {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }
    
    .btn-group .btn {
        width: 100%;
        border-radius: 8px !important;
    }
    
    /* 表单进一步优化 */
    .form-control, .form-select {
        font-size: 16px;
        padding: 0.7rem 0.9rem;
    }
    
    /* 统计卡片 */
    .stat-number {
        font-size: 2rem !important;
    }
    
    .stat-title {
        font-size: 0.9rem !important;
    }
    
    /* 模态框 */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-body {
        padding: 1.25rem;
        max-height: calc(100vh - 180px);
    }
    
    /* 快速操作按钮单列显示 */
    .quick-action-btn {
        width: 100%;
    }
    
    /* 报价查询单列显示 */
    .price-item-card {
        width: 100%;
    }
    
    /* 统计卡片单列显示 */
    .stat-card {
        width: 100%;
    }
}

/* ========== 超小屏幕优化 (≤375px) ========== */
@media screen and (max-width: 375px) {
    html {
        font-size: 12px;
    }
    
    .brand-text-main {
        font-size: 0.95rem !important;
    }
    
    .brand-text-sub {
        font-size: 0.65rem !important;
    }

    .store-badge {
        max-width: 96px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sidebar {
        width: 82vw !important;
        left: -82vw !important;
    }
    
    .navbar-text {
        display: none;
    }
    
    h1 {
        font-size: 1.15rem;
    }
    
    h2 {
        font-size: 1.05rem;
    }
    
    .btn {
        font-size: 0.85rem;
        padding: 0.55rem 1rem;
        min-height: 42px;
    }
    
    .btn-sm {
        font-size: 0.8rem;
        padding: 0.45rem 0.85rem;
        min-height: 38px;
    }
    
    .card-body {
        padding: 0.875rem !important;
    }
    
    .stat-number {
        font-size: 1.75rem !important;
    }
}

/* ========== 横屏优化 ========== */
@media screen and (max-width: 768px) and (orientation: landscape) {
    .sidebar {
        top: 50px !important;
        height: calc(100dvh - 50px) !important;
        width: min(64vw, 240px) !important;
        left: calc(-1 * min(64vw, 240px)) !important;
    }

    .sidebar.show {
        left: 0 !important;
    }
    
    .sidebar-overlay {
        top: 50px;
    }
    
    .navbar {
        min-height: 50px;
    }
    
    .content-wrapper {
        padding-top: 0.5rem;
    }
    
    h1 {
        font-size: 1.3rem;
        margin-top: 0.5rem !important;
    }
}

/* ========== 触摸设备优化 ========== */
@media (hover: none) and (pointer: coarse) {
    /* 增加触摸目标大小 */
    .nav-link {
        min-height: 48px;
        display: flex;
        align-items: center;
        padding: 0.75rem 1rem !important;
    }
    
    /* 按钮触摸反馈 */
    .btn {
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.18);
    }
    
    .btn:active {
        transform: scale(0.97);
        opacity: 0.85;
    }
    
    /* 卡片点击反馈 */
    .card {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.05);
    }
    
    .card:active {
        transform: scale(0.98);
    }
    
    /* 移除hover效果 */
    .btn:hover {
        transform: none;
    }
    
    /* 链接触摸优化 */
    a {
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.18);
    }
    
    /* 输入框优化 */
    input, textarea, select {
        -webkit-tap-highlight-color: rgba(37, 99, 235, 0.18);
    }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .sidebar-overlay,
    .navbar-nav.ms-auto .btn,
    .navbar-nav.ms-auto .btn-header-outline {
        transition: none !important;
    }
}

/* ========== Figma 设计系统 — 移动端适配 ========== */
@media screen and (max-width: 768px) {
    :root {
        --radius-xl: 20px;
        --radius-lg: 14px;
        --radius-md: 10px;
    }

    .card:not(.no-glass),
    .glass-panel,
    .card-clean {
        border-radius: var(--radius-lg) !important;
    }

    .card-body {
        padding: 1.25rem !important;
    }

    .glass-panel .panel-header {
        padding: 1rem 1.25rem 0.5rem;
    }

    .glass-panel .panel-body {
        padding: 1rem 1.25rem 1.25rem;
    }

    .management-hero,
    .price-hero {
        flex-direction: column;
        align-items: flex-start;
        padding: 1.5rem;
        border-radius: var(--radius-lg);
        gap: 1.25rem;
    }

    .management-hero .hero-title,
    .price-hero .hero-title {
        font-size: 1.35rem;
    }

    .management-hero .hero-desc,
    .price-hero .hero-desc {
        font-size: 0.82rem;
    }

    .hero-metrics {
        width: 100%;
        justify-content: space-between;
    }

    .hero-metrics .metric-card {
        flex: 1;
        min-width: 0;
        padding: 0.6rem 0.75rem;
    }

    .hero-metrics .metric-card strong {
        font-size: 1.15rem;
    }

    .hero-metrics .metric-card span {
        font-size: 0.65rem;
    }

    .workorder-filter-bar {
        padding: 0.875rem 1rem;
        border-radius: var(--radius-lg);
    }

    .filter-field .form-control,
    .filter-field .form-select {
        min-height: 44px;
        font-size: 16px;
    }

    .btn,
    .btn-primary,
    .btn-gradient {
        min-height: 44px;
    }

    .table th,
    .table td {
        padding: 0.65rem 0.75rem;
        font-size: 0.8125rem;
    }

    .quick-filter-btn {
        padding: 0.4rem 0.75rem !important;
        font-size: 0.8125rem !important;
    }

    .price-matrix-wrap {
        max-height: calc(100vh - 220px);
        border-radius: var(--radius-md);
    }

    .price-matrix-table {
        font-size: 0.75rem;
    }
}

@media screen and (max-width: 480px) {
    .hero-metrics {
        flex-direction: column;
    }

    .hero-metrics .metric-card {
        width: 100%;
    }
}

@media print {
    .sidebar,
    .navbar,
    .sidebar-overlay,
    .btn,
    .pagination {
        display: none !important;
    }
    
    .content-wrapper {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
