/* ========================================
   JwhooOpen 移动端响应式适配
   平板: ≤1024px | 手机: ≤767px
   所有规则仅在 @media 内，PC 端零影响
   ======================================== */

:root {
    --mobile-sidebar-width: 280px;
    --mobile-header-height: 56px;
    --mobile-overlay-bg: rgba(0, 0, 0, 0.45);
}

/* ========================================
   平板适配 (≤1024px)
   ======================================== */
@media (max-width: 1024px) {

    /* --- 平板端 Header 适配 --- */
    #admin_head_body {
        box-sizing: border-box !important;
        width: 100% !important;
        padding: 0 16px !important;
    }

    #admin_head_body ul {
        height: 80px !important;
        gap: 8px !important;
    }

    /* 平板端隐藏 header 中的文字标签，只保留图标 */
    .aiAgent-headerBtnLabel,
    .aiAgent-headerBtnBeta,
    .mailBox-headerLabel {
        display: none !important;
    }

    .header_title {
        font-size: 16px !important;
        margin-left: 10px !important;
        max-width: 200px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #system_logo {
        width: 40px !important;
        height: auto !important;
        margin-top: 24px !important;
    }

    .header-nav-box {
        min-width: 40px !important;
        height: 40px !important;
        line-height: 40px !important;
        padding: 0 12px !important;
    }

    /* 隐藏用户名公司名（平板端空间不够） */
    #companyName {
        display: none !important;
    }

    /* --- 侧边栏：由 mobile-nav.js 在平板视口下自动添加 .nav-collapsed class --- */
    /* 隐藏三级子导航 */
    #admin_nav_child_body {
        display: none !important;
    }

    /* 主内容区：覆盖 index.css 的 width: 86%，避免 64px + 86% 溢出 */
    #admin_main_body {
        min-width: 0 !important;
        width: auto !important;
        flex: 1;
    }

    /* 面板缩减 padding */
    .jzy_desktop_panel {
        padding: 16px 20px !important;
        margin-left: 10px !important;
        margin-right: 10px !important;
    }

    .panel-header {
        height: auto;
        min-height: 48px;
        line-height: 1.4;
        padding: 12px 20px;
        margin-left: -20px;
        margin-right: -20px;
        font-size: 16px;
    }

    /* 搜索表单换行 */
    .keyword_search_input,
    .keyword_search_text,
    .keyword_search_select {
        width: 140px;
        min-width: 120px;
    }

    .keyword_btn_panel {
        margin-top: 6px;
    }

    /* 表格横向滚动优化 */
    .common_table {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }

    /* 滚动渐变指示器 */
    .common_table::after {
        content: '';
        position: sticky;
        right: 0;
        top: 0;
        bottom: 0;
        width: 32px;
        min-height: 100%;
        float: right;
        background: linear-gradient(to right, transparent, var(--theme-bg));
        pointer-events: none;
        z-index: 1;
    }

    /* 表头不换行 */
    .keyword_table_hd th,
    .keyword_table_hd td {
        white-space: nowrap;
    }

    /* Sticky 列背景：确保覆盖滚动内容 */
    .sticky-btn-link-group,
    .sticky-checkbox-link-group {
        background: var(--theme-surface-strong) !important;
        z-index: 2;
    }

    /* 分页换行 */
    nav.page-nav-outer {
        flex-wrap: wrap;
    }
}


/* ========================================
   手机适配 (≤767px)
   ======================================== */
@media (max-width: 767px) {

    /* --- Header --- */
    #head.theme_header {
        height: var(--mobile-header-height) !important;
        min-height: var(--mobile-header-height) !important;
        position: sticky;
        top: 0;
    }

    #head {
        height: var(--mobile-header-height) !important;
    }

    #head.header-hidden {
        transform: none !important;
    }

    #admin_head_body {
        box-sizing: border-box !important;
        width: 100% !important;
        padding: 0 8px !important;
        height: var(--mobile-header-height) !important;
    }

    #admin_head_body ul {
        height: var(--mobile-header-height) !important;
        gap: 4px !important;
        flex-shrink: 0;
    }

    /* 手机端隐藏 logo 图片和平台名称 */
    #system_logo {
        display: none !important;
    }

    .header_title {
        display: none !important;
    }

    /* 隐藏 header 中非必要元素（手机端保留头像、退出、站内信、AI助手） */
    /* 用户名/公司名所在的 <li> 隐藏 */
    #admin_head_body ul > li:has(#myUserName) {
        display: none !important;
    }

    .header-nav-box {
        min-width: 36px !important;
        height: 36px !important;
        line-height: 36px !important;
        padding: 0 10px !important;
        font-size: 13px !important;
    }

    .logined_user_avatar,
    #common_user_avatar img {
        height: 36px !important;
        width: 36px !important;
    }

    /* --- 汉堡按钮 --- */
    .mobile-hamburger-btn {
        display: flex;
        position: fixed;
        top: 8px;
        left: 8px;
        z-index: 10001;
        width: 36px;
        height: 36px;
        border-radius: 10px;
        background: var(--theme-surface-strong);
        border: 1px solid var(--theme-border);
        align-items: center;
        justify-content: center;
        font-size: 16px;
        color: var(--theme-text);
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-hamburger-btn:active {
        transform: scale(0.95);
    }

    /* --- 侧边栏抽屉 --- */
    #admin_nav_body {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: var(--mobile-sidebar-width) !important;
        max-width: 80vw;
        height: 100vh !important;
        min-height: 100vh !important;
        max-height: 100vh !important;
        z-index: 10000 !important;
        border-radius: 0 !important;
        box-shadow: none;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        align-self: auto !important;
    }

    #admin_nav_body.is-mobile-open {
        transform: translateX(0) !important;
        box-shadow: 8px 0 32px rgba(0, 0, 0, 0.2);
    }

    /* 抽屉模式下恢复完整侧边栏样式 */
    #admin_nav_body.is-mobile-open .nav_title_name {
        opacity: 1 !important;
        width: auto !important;
        overflow: visible;
    }

    #admin_nav_body.is-mobile-open .nav-up-icon,
    #admin_nav_body.is-mobile-open .nav-down-icon,
    #admin_nav_body.is-mobile-open .nav_top_title > .fa-chevron-up,
    #admin_nav_body.is-mobile-open .nav_top_title > .fa-chevron-down {
        opacity: 1 !important;
        width: auto !important;
        overflow: visible;
    }

    #admin_nav_body.is-mobile-open .nav_top_title {
        justify-content: flex-start !important;
        gap: 12px !important;
        padding-left: 22px !important;
        padding-right: 18px !important;
        min-height: 58px;
        margin: 6px 0;
        border-radius: 20px;
    }

    #admin_nav_body.is-mobile-open #admin_nav_ul ul.fs_13 {
        display: block !important;
    }

    #admin_nav_body.is-mobile-open .nav-collapse-toggle {
        display: flex;
    }

    #admin_nav_body #admin_nav_ul {
        height: calc(100vh - 60px) !important;
    }

    /* --- 遮罩层 --- */
    .mobile-nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 9999;
        background: var(--mobile-overlay-bg);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .mobile-nav-overlay.is-active {
        opacity: 1;
        pointer-events: auto;
    }

    /* --- 主体布局 --- */
    #admin_body {
        flex-direction: column !important;
        min-height: auto !important;
    }

    #admin_main_body {
        width: 100% !important;
        min-width: 0 !important;
        flex: 1;
        padding: 0;
    }

    /* --- 面板卡片 --- */
    .jzy_desktop_panel {
        padding: 14px 16px !important;
        margin: 8px !important;
        border-radius: 16px !important;
    }

    .panel-header {
        height: auto !important;
        min-height: 44px;
        line-height: 1.4 !important;
        padding: 12px 16px !important;
        margin-left: -16px !important;
        margin-right: -16px !important;
        margin-top: -14px !important;
        font-size: 15px;
        flex-wrap: wrap;
    }

    .panel-header .keyword_btn_panel {
        float: none !important;
        margin-top: 8px;
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }

    /* --- 搜索/筛选表单 --- */
    .keyword_search_panel {
        float: none !important;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
    }

    .keyword_search_input,
    .keyword_search_text,
    .keyword_search_select,
    select.keyword_search_input {
        float: none !important;
        width: 100% !important;
        min-width: 0;
        flex: 1 1 calc(50% - 6px);
    }

    .keyword_search_input:first-child:last-child,
    .keyword_search_text:first-child:last-child {
        flex: 1 1 100%;
    }

    /* --- 操作按钮 --- */
    .keyword_btn_panel {
        float: none !important;
        text-align: left;
        width: 100%;
        margin-top: 6px;
    }

    .keyword_add {
        margin-bottom: 4px !important;
    }

    .order-status-btn {
        min-width: 80px;
        margin-right: 6px;
        margin-top: 4px;
    }

    /* --- 数据表格：卡片布局 --- */
    .common_table {
        overflow: visible !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
    }

    /* 表格变成块级容器 */
    .keyword_table,
    .keyword_table thead,
    .keyword_table tbody {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
    }

    /* 隐藏表头行 — 每个单元格通过 data-label 显示列名 */
    .keyword_table .keyword_table_hd {
        display: none !important;
    }

    /* 数据行 → 卡片 */
    .keyword_table_item {
        display: flex !important;
        flex-wrap: wrap !important;
        padding: 0 !important;
        margin: 10px 0 !important;
        border-radius: 14px !important;
        border: 1px solid var(--theme-border) !important;
        background: var(--theme-surface-strong) !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
        overflow: hidden;
        height: auto !important;
        width: 100% !important;
    }

    /* 通用单元格 — 变为 label-value 块 */
    .keyword_table_item td {
        display: flex !important;
        flex-direction: column !important;
        align-items: flex-start !important;
        text-align: left !important;
        width: 50% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        height: auto !important;
        padding: 8px 14px !important;
        border: none !important;
        border-bottom: 1px solid rgba(0, 0, 0, 0.04) !important;
        font-size: 13px !important;
        line-height: 1.5 !important;
        box-sizing: border-box !important;
        background: transparent !important;
        position: static !important;
        left: auto !important;
        right: auto !important;
    }

    /* 单元格标签 — 来自 JS 设置的 data-label */
    .keyword_table_item td::before {
        content: attr(data-label);
        display: block;
        font-size: 11px !important;
        font-weight: 600 !important;
        color: var(--theme-text-soft) !important;
        margin-bottom: 2px;
        letter-spacing: 0.02em;
    }

    /* 奇数单元格去掉右边框间距（2列布局时对齐） */
    .keyword_table_item td:nth-child(odd) {
        border-right: 1px solid rgba(0, 0, 0, 0.04) !important;
    }

    /* ID / 首列（sticky-checkbox-link-group）→ 卡片标题行，占满宽度 */
    .keyword_table_item td.sticky-checkbox-link-group {
        width: 100% !important;
        flex-direction: row !important;
        align-items: center !important;
        font-weight: 700 !important;
        font-size: 14px !important;
        padding: 12px 14px !important;
        background: rgba(0, 0, 0, 0.02) !important;
        border-bottom: 1px solid var(--theme-border) !important;
        border-right: none !important;
    }

    .keyword_table_item td.sticky-checkbox-link-group::before {
        display: none;
    }

    /* 操作列（sticky-btn-link-group）→ 卡片底部按钮栏 */
    .keyword_table_item td.sticky-btn-link-group {
        width: 100% !important;
        flex-direction: row !important;
        justify-content: flex-end !important;
        align-items: center !important;
        gap: 6px;
        padding: 10px 14px !important;
        border-top: 1px solid var(--theme-border) !important;
        border-bottom: none !important;
        border-right: none !important;
        background: transparent !important;
    }

    .keyword_table_item td.sticky-btn-link-group::before {
        display: none;
    }

    .keyword_table_item .weui-desktop-link-group {
        display: flex !important;
        flex-wrap: wrap;
        gap: 6px;
    }

    /* 单列全宽：数据量较长的单元格（地址、备注等） */
    .keyword_table_item td[style*="min-width: 250"],
    .keyword_table_item td[style*="min-width: 300"],
    .keyword_table_item td[style*="min-width: 400"],
    .keyword_table_item td[style*="min-width: 500"],
    .keyword_table_item td[style*="min-width:250"],
    .keyword_table_item td[style*="min-width:300"],
    .keyword_table_item td[style*="min-width:400"],
    .keyword_table_item td[style*="min-width:500"] {
        width: 100% !important;
        border-right: none !important;
    }

    /* 表格内的图片缩小 */
    .keyword_table_item td img {
        max-width: 48px;
        max-height: 48px;
        border-radius: 6px;
    }

    /* 表格内的 badge / tag 不换行 */
    .keyword_table_item td .badge,
    .keyword_table_item td .tag,
    .keyword_table_item td span[class*="status"] {
        white-space: nowrap;
        display: inline-block;
    }

    /* 行间分隔线 */
    .keyword_table_item + .keyword_table_item {
        margin-top: 10px;
    }

    /* --- 分页 --- */
    nav.page-nav-outer {
        padding: 10px 0 !important;
        flex-wrap: wrap;
    }

    nav.page-nav-outer .pagination > li > a {
        padding: 4px 8px !important;
        font-size: 12px !important;
    }

    nav.page-nav-outer .page-input-box {
        display: block;
        float: none;
        margin: 8px 0;
    }

    /* --- ECharts 图表 --- */
    .statistic-box,
    .statistic-mid,
    .statistic-right,
    .statistic-left,
    [id^="echart"],
    [id^="chart"],
    .echart-container {
        width: 100% !important;
        height: 280px !important;
        float: none !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* --- 双栏面板堆叠 --- */
    .panel-left,
    .panel-right,
    .dashboard-panel-left,
    .dashboard-panel-right {
        width: 100% !important;
        float: none !important;
        margin-left: 0 !important;
    }

    .panel-right {
        margin-top: 16px;
    }

    /* --- 统计卡片网格 --- */
    .stat-item {
        width: 50% !important;
    }

    .statistic-panel-item {
        width: 100% !important;
        margin-right: 0 !important;
    }

    /* --- IM 聊天面板 --- */
    .im-customer-box {
        width: 100% !important;
        float: none !important;
        border-right: none !important;
    }

    .im-customer-message-box {
        width: 100% !important;
        margin-left: 0 !important;
    }

    /* --- 监控面板 --- */
    .monitor-workbench {
        flex-direction: column !important;
    }

    .monitor-workbench-side {
        width: 100% !important;
        flex: auto !important;
    }

    /* --- 订单详情产品列表 --- */
    .order-product-image-box {
        width: 60px !important;
    }

    .order-product-info {
        flex: 1;
        min-width: 0;
    }

    .order-product-loc,
    .order-product-num,
    .order-product-change {
        width: auto !important;
        min-width: 60px;
        float: none !important;
    }

    /* --- 赠品订单模块 --- */
    .stat-card {
        min-width: 0 !important;
        flex: 1 1 calc(50% - 6px) !important;
    }

    .page-intro {
        padding: 14px 16px !important;
        margin: -14px -16px 0 -16px !important;
    }

    /* --- 模态/浮层 --- */
    .c-float-popWrap {
        width: 92% !important;
        left: 4% !important;
        transform: none !important;
        margin: 0;
    }

    /* --- 字段筛选浮层微调 --- */
    #columnPicker {
        max-width: 85vw;
    }

    /* --- footer --- */
    .theme_footer {
        padding: 12px 16px !important;
    }

    /* --- notice --- */
    .notice-background {
        padding: 8px 16px !important;
        font-size: 13px !important;
    }

    /* --- AI Agent 面板 --- */
    #aiAgentPanel {
        width: 100vw !important;
        height: 100vh !important;
        right: 0 !important;
        top: 0 !important;
        border-radius: 0 !important;
    }

    /* --- 邮箱面板 --- */
    #mailBoxPanel {
        width: 100vw !important;
        height: 100vh !important;
        right: 0 !important;
        top: 0 !important;
        border-radius: 0 !important;
    }

    /* --- 通用溢出保护 --- */
    #admin_main_body {
        overflow-x: hidden;
    }

    img {
        max-width: 100%;
        height: auto;
    }

    /* --- 任务/工单相关 --- */
    .mission-handle-box {
        width: 100% !important;
        margin-right: 0 !important;
    }

    /* --- 通用表格容器 --- */
    #tableContainer,
    .table-scroll-wrapper {
        -webkit-overflow-scrolling: touch;
    }
}

/* 隐藏汉堡按钮在非手机端 */
@media (min-width: 768px) {
    .mobile-hamburger-btn {
        display: none !important;
    }

    .mobile-nav-overlay {
        display: none !important;
    }
}


/* ========================================
   页面级适配 — 覆盖各页面内联固定宽度/高度
   ======================================== */
@media (max-width: 767px) {

    /* --- 订单模块 --- */

    /* 监控工作台：侧面板堆叠 */
    .monitor-workbench-side {
        width: 100% !important;
        flex: 0 0 auto !important;
    }

    .monitor-queue-panel {
        min-height: 300px !important;
    }

    .monitor-queue-list {
        max-height: 260px !important;
    }

    .monitor-stage {
        min-height: 300px !important;
        padding: 12px !important;
    }

    .monitor-stage-title {
        font-size: 16px !important;
    }

    .monitor-stage-header {
        flex-direction: column !important;
    }

    .monitor-inline-grid {
        grid-template-columns: 1fr !important;
    }

    .monitor-inline-slot {
        min-height: 180px !important;
    }

    /* 监控视频四宫格 → 单列 */
    #four-monitor {
        display: flex !important;
        flex-direction: column !important;
    }

    .monitor-video {
        width: 100% !important;
        height: auto !important;
    }

    .monitor-only-one,
    #only-one {
        margin-left: 0 !important;
        margin-top: 0 !important;
    }

    /* 浮层/弹窗：覆盖 min-width */
    .warehouse-guide-wrapper,
    .float-div,
    .float-div-box {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .float-div-box[style*="width: 500px"] {
        width: 100% !important;
        height: auto !important;
    }

    .float-div-head[style*="width: 475px"] {
        width: 100% !important;
    }

    .warehouse-guide-wrapper .monitor-head,
    .warehouse-guide-wrapper .monitor-left,
    .float-div .float-div-head {
        min-width: 0 !important;
        width: auto !important;
    }

    /* 备注框 textarea */
    #remark_textarea {
        width: calc(100% - 32px) !important;
        height: 200px !important;
        margin-left: 16px !important;
        margin-top: 16px !important;
    }

    /* 库存修改面板 */
    #editStockPanel .float-div-box {
        width: 100% !important;
        height: auto !important;
    }

    #editStockPanel .float-div-head {
        width: auto !important;
    }

    #editStockPanel div[style*="width: 420px"] {
        width: 100% !important;
        height: auto !important;
    }

    /* 订单详情信息网格 */
    .detail-info-item {
        min-width: 0 !important;
        flex: 1 1 100% !important;
        padding: 8px 0 !important;
    }

    /* 订单筛选面板内输入框 */
    .order-filter-body .keyword_search_input {
        width: 100% !important;
    }

    /* 订单详情面板右侧 */
    .panel-right[style*="display: none"],
    .panel-right {
        width: 100% !important;
        float: none !important;
    }

    /* 订单信息行 */
    .order-right-info-box {
        display: flex;
        flex-wrap: wrap;
    }

    .order-info-left {
        min-width: 80px;
        flex-shrink: 0;
    }

    /* --- 仓库指引图弹窗 --- */
    .warehouse-guide-modal {
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 90vh !important;
    }

    .warehouse-guide-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        gap: 10px !important;
    }

    .warehouse-guide-body {
        padding: 12px !important;
    }

    /* --- 监控老版弹出框 --- */
    .monitor-box {
        width: 100% !important;
        height: auto !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        z-index: 99999 !important;
    }

    .monitor-left {
        width: 100% !important;
        min-width: 0 !important;
    }
}

/* 平板端监控面板也做适配 */
@media (max-width: 1024px) {
    .monitor-workbench-side {
        width: 100% !important;
        flex: 0 0 auto !important;
    }

    .monitor-workbench-main {
        flex: 1;
    }

    .monitor-inline-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
}


/* ========================================
   逐页面精细适配
   ======================================== */
@media (max-width: 767px) {

    /* --- 仓库模块：库存页面购物车面板 --- */
    .cart-panel {
        width: 100% !important;
        float: none !important;
        margin-top: 16px;
    }

    .cart-panel + .panel-left {
        width: 100% !important;
    }

    /* 购物车抽屉内部 fixed width: 420px */
    #cartPanelOverlay > div {
        width: 100% !important;
        max-width: 100vw !important;
    }

    /* 加入购物车弹窗 min-width: 350px */
    #addToCartDialog > div {
        min-width: 0 !important;
        width: calc(100vw - 32px) !important;
        max-width: calc(100vw - 32px) !important;
        padding: 20px !important;
        box-sizing: border-box;
    }

    /* 仓库扫码记录 / 商品管理：详情面板展开时列表宽度 */
    #list-panel.panel-with-detail,
    #list-panel {
        width: 100% !important;
    }

    /* 仓库编辑页：表格表单布局改为块级 */
    .weui-desktop-form__control-group {
        display: block !important;
        width: 100% !important;
    }

    .weui-desktop-form__controls {
        display: block !important;
        width: 100% !important;
    }

    /* 通用：覆盖所有 style="width: 300px" 的输入框 */
    input[style*="width: 300px"],
    input[style*="width:300px"],
    input[style*="width: 240px"],
    input[style*="width:240px"],
    select[style*="width: 300px"],
    select[style*="width:300px"],
    select[style*="width: 210px"],
    select[style*="width:210px"] {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* --- 采购模块 --- */

    /* 采购下单：订单信息网格单列 */
    .order-info-grid {
        grid-template-columns: 1fr !important;
    }

    /* 采购下单：添加商品弹窗 1000px → 自适应 */
    #float-div-add-product .float-div-box {
        width: 95vw !important;
        max-width: 95vw !important;
        height: 85vh !important;
    }

    /* 采购下单：支付弹窗 */
    #float-div .float-div-box,
    #float-div1 .float-div-box {
        width: 95vw !important;
        max-width: 400px !important;
        height: auto !important;
    }

    /* 购物车结算：表单组全宽 */
    .weui-desktop-form__control-group[style*="width: 50%"] {
        width: 100% !important;
    }

    /* 购物车结算：备注 textarea */
    textarea[style*="width: 300px"],
    textarea[style*="width:300px"] {
        width: 100% !important;
        margin-left: 0 !important;
        box-sizing: border-box;
    }

    /* --- 账单模块 --- */

    /* 账单详情：固定宽度 label / div */
    .franchiseeBillDetail-label,
    div[style*="width: 200px"],
    label[style*="width: 200px"],
    label[style*="width:200px"] {
        width: auto !important;
        min-width: 80px;
        max-width: 100%;
    }

    /* 充值页：支付弹窗 */
    #float-div .float-div-box[style*="width: 360px"],
    #float-div1 .float-div-box[style*="width: 360px"] {
        width: 95vw !important;
        max-width: 400px !important;
        height: auto !important;
    }

    /* 充值页：弹窗内部固定宽度 */
    div[style*="width: 335px"],
    div[style*="width:335px"],
    div[style*="width: 340px"],
    div[style*="width:340px"],
    div[style*="width: 255px"],
    div[style*="width:255px"] {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* --- 工单模块 --- */

    /* 工单列表：备注弹窗 */
    .warehouse-guide-wrapper[style*="min-width: 520px"],
    .warehouse-guide-wrapper[style*="min-width:520px"] {
        min-width: 0 !important;
    }

    .warehouse-guide-wrapper .monitor-head[style*="min-width: 495px"],
    .warehouse-guide-wrapper .monitor-head[style*="min-width:495px"] {
        min-width: 0 !important;
    }

    .warehouse-guide-wrapper .monitor-left[style*="min-width: 520px"],
    .warehouse-guide-wrapper .monitor-left[style*="min-width:520px"] {
        min-width: 0 !important;
    }

    /* 工单备注 textarea 固定 480px */
    textarea[style*="width: 480px"],
    textarea[style*="width:480px"],
    textarea[style*="width: 550px"],
    textarea[style*="width:550px"] {
        width: calc(100% - 32px) !important;
        margin-left: 16px !important;
        box-sizing: border-box;
    }

    /* 新建工单 textarea 固定 300px */
    .add-textarea[style*="width: 300px"] {
        width: 100% !important;
        box-sizing: border-box;
    }

    /* --- 跟进进度模块：卡片 340px → 自适应 */
    .survey-card {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* --- 门店物流编辑页 --- */
    .logistic-rule-col {
        min-width: 0 !important;
        flex: 1 1 100% !important;
    }

    /* --- 统计模块：数据概览页 --- */
    .data-trend-chart {
        height: 280px !important;
        min-height: 280px !important;
    }

    #line-bar {
        min-height: 250px !important;
    }

    .data-panel-title {
        font-size: 18px !important;
    }

    /* --- 商品管理：详情面板 --- */
    .panel-right.panel-right[style],
    #clicked-detail.panel-right {
        width: 100% !important;
        float: none !important;
        margin-left: 0 !important;
    }

    /* --- 通用 float-div 弹窗（覆盖 light.css 中的 1000px 默认宽度） --- */
    .float-div .float-div-box {
        width: 95vw !important;
        max-width: 600px !important;
        height: auto !important;
        max-height: 85vh;
        overflow-y: auto;
    }

    /* float-div 弹窗标题栏：取消 float:left（浮动元素会收缩到内容宽度，导致标题栏
       不能占满弹窗宽度），改为块级 + 100% 宽，撑满整个弹窗顶部。 */
    .float-div-head {
        float: none !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .warehouse-guide-wrapper {
        width: 95vw !important;
        max-width: 95vw !important;
    }

    /* --- 仓库指引图弹窗 --- */
    .warehouse-guide-modal {
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 90vh !important;
    }

    .warehouse-guide-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)) !important;
        gap: 10px !important;
    }

    .warehouse-guide-body {
        padding: 12px !important;
    }
}


/* ========================================
   delivery-auth 登录页移动端适配
   ======================================== */
@media (max-width: 767px) {
    #login-container {
        width: 90% !important;
        max-width: 400px;
        position: static !important;
        right: auto !important;
        top: auto !important;
        margin: 60px auto 0 !important;
        flex-direction: column !important;
        align-items: center !important;
        animation: none !important;
    }

    #login-container > div:first-child {
        text-align: center !important;
    }

    #login-container > div:first-child p {
        font-size: 28px !important;
    }

    #login-box {
        width: 100% !important;
        max-width: 350px;
        margin: 20px auto 0;
    }

    #login-with-pw {
        margin-left: 0 !important;
    }

    #login-box input[type='password'],
    #login-box input[type='text'] {
        width: 100% !important;
        max-width: 300px;
        height: 44px !important;
        line-height: 44px !important;
    }

    .login-button {
        width: 100% !important;
        max-width: 300px;
        height: 44px !important;
        line-height: 44px !important;
    }

    #program-code-img {
        margin-top: 20px !important;
    }

    #accreditation {
        position: static !important;
        text-align: center;
        margin-top: 30px;
        padding-bottom: 20px;
    }
}


/* ========================================
   组件级移动端修复（v1.3 增补）
   - .popup toast：light.css 固定 width:500px，移动端居中后右侧被裁
   - .condition-row 输入框：基础 .keyword_search_input width:200px 撑破条件行
   ======================================== */
@media (max-width: 767px) {

    /* --- 全局 toast：宽度自适应视口，不再被裁 --- */
    .popupDom {
        width: 100% !important;
        padding: 0 12px !important;
        box-sizing: border-box !important;
    }

    .popup {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        border-radius: 14px !important;
    }

    /* --- 条件行（editStoreLogistic / updateAllStore 自动发单规则）：
         让“标签 + 输入框 + 单位”在一行内不溢出；输入框收窄 --- */
    .condition-row {
        flex-wrap: wrap !important;
    }

    .condition-row input.keyword_search_input,
    .condition-row .keyword_search_input {
        width: 90px !important;
        flex: 0 0 auto !important;
        min-width: 0 !important;
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    /* --- 仓库取货码缩略图：暗色主题下整块白色太刺眼 ---
       二维码本身必须白底（可扫描），这里给白色容器加细描边 + 圆角 + 缩放，
       让它看起来像一个有意为之的“码片”，而非突兀的白色色块。 --- */
    .row-pickcode-thumb {
        border: 1px solid var(--theme-border) !important;
        border-radius: 6px !important;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25) !important;
        transform: scale(0.82);
        transform-origin: left center;
    }

    /* --- 仓库状态列：图标 + 文字强制同行，避免卡片模式下折行 ---
       卡片模式 td 是 flex-direction:column，::before(列名) + svg + 文字 会纵向堆叠，
       导致状态图标和“运营中/未运营”文字上下两行。
       这里把含状态图标的单元格改回块级布局（取消 flex），::before 列名仍是块级
       独占一行，其后的 svg 与文字以 inline 方式自然并排在一行。 --- */
    .keyword_table_item td.keywords_name_cell svg.icon {
        width: 12px;
        height: 12px;
        vertical-align: middle;
        margin-right: 4px;
    }

    .keyword_table_item td.keywords_name_cell:has(svg.icon) {
        display: block !important;
        white-space: nowrap !important;
    }

    /* ::before 列名：块级独占一行，与下方内容分隔 */
    .keyword_table_item td.keywords_name_cell:has(svg.icon)::before {
        display: block !important;
        margin-bottom: 4px;
    }
}
