/* ========================================
   好世数据看板 - 公共样式(精致化版)
   参考钉钉数据看板现代化UI风格
   ======================================== */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #1677ff;
    --primary-light: #4096ff;
    --primary-grad: linear-gradient(135deg, #1677ff, #69b1ff);
    --success: #52c41a;
    --warning: #faad14;
    --danger: #ff4d4f;
    --bg-main: #f0f2f5;
    --bg-card: #ffffff;
    --text-primary: #1f1f1f;
    --text-secondary: #8c8c8c;
    --border: #f0f0f0;
    --shadow: 0 1px 4px rgba(0,0,0,0.08);
    --shadow-hover: 0 6px 20px rgba(22, 119, 255, 0.10), 0 2px 8px rgba(0,0,0,0.06);
    --radius: 12px;
    --radius-sm: 8px;
}

body {
    background: var(--bg-main);
    color: var(--text-primary);
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ===== 顶部导航栏 ===== */
.navbar {
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(8px);
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 28px;
    box-shadow: 0 1px 0 var(--border), 0 2px 12px rgba(0,0,0,0.04);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar .logo {
    font-size: 18px;
    font-weight: 700;
    background: var(--primary-grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-right: 40px;
    white-space: nowrap;
    letter-spacing: 0.5px;
}
.navbar .nav-tabs {
    display: flex;
    gap: 6px;
    flex: 1;
}
.navbar .nav-tab {
    padding: 8px 20px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 14px;
    transition: all 0.2s;
    font-weight: 500;
}
.navbar .nav-tab:hover {
    background: #f0f5ff;
    color: var(--primary);
}
.navbar .nav-tab.active {
    background: var(--primary-grad);
    color: #fff;
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.35);
}
.navbar .nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-secondary);
}
.navbar .refresh-btn {
    padding: 6px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.navbar .refresh-btn:hover {
    color: var(--primary);
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(22,119,255,0.15);
}

/* ===== 导出Excel按钮(统一风格) ===== */
.btn-export {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: 1px solid #95de64;
    border-radius: 8px;
    background: linear-gradient(135deg, #f6ffed 0%, #e8fbd4 100%);
    color: #389e0d;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    white-space: nowrap;
}
.btn-export:hover {
    border-color: #73d13d;
    background: linear-gradient(135deg, #e8fbd4 0%, #d9f7be 100%);
    box-shadow: 0 2px 8px rgba(56,158,13,0.18);
    transform: translateY(-1px);
}
.btn-export:active {
    transform: translateY(0);
    box-shadow: none;
}

/* ===== 主内容区 ===== */
.main-content {
    padding: 22px 28px;
    max-width: 1600px;
    margin: 0 auto;
}

/* ===== 页面标题头 ===== */
.page-header {
    margin-bottom: 18px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}
.page-header h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}
.page-header p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== 统计卡片行 ===== */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--primary-grad);
    opacity: 0.85;
}
.stat-card:hover {
    box-shadow: var(--shadow-hover);
    transform: translateY(-3px);
}
.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 10px;
    letter-spacing: 0.3px;
}
.stat-card .stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    letter-spacing: 0.2px;
    font-variant-numeric: tabular-nums;
}
.stat-card .stat-unit {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 4px;
}
.stat-card .stat-trend {
    font-size: 12px;
    margin-top: 8px;
}
.stat-card .stat-flag {
    font-size: 11px;
    font-weight: 500;
    color: #1677ff;
    background: rgba(22,119,255,.10);
    border: 1px solid rgba(22,119,255,.25);
    border-radius: 10px;
    padding: 1px 8px;
    margin-left: 6px;
    vertical-align: middle;
    white-space: nowrap;
}
.stat-trend.up { color: var(--success); }
.stat-trend.down { color: var(--danger); }
.stat-trend.neutral { color: var(--text-secondary); }

/* ===== 筛选区 ===== */
.filter-bar {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    box-shadow: var(--shadow);
}
.filter-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.filter-item label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    font-weight: 500;
}
.filter-item select {
    padding: 7px 32px 7px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 13px;
    min-width: 140px;
    background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238c8c8c' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.filter-item select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}
.filter-item input[type="date"] {
    padding: 6px 10px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 13px;
    min-width: 140px;
    background: #fff;
    color: var(--text-primary);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.filter-item input[type="date"]:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}
.filter-item .multi-select {
    min-width: 200px;
    height: 32px;
}

/* ===== 状态筛选 Tab(库存健康度预警等) ===== */
.so-status-tab {
    padding: 3px 12px;
    font-size: 12px;
    border: 1px solid #d9d9d9;
    border-radius: 14px;
    background: #fff;
    color: #595959;
    cursor: pointer;
    transition: all .2s;
    line-height: 1.7;
    white-space: nowrap;
}
.so-status-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.so-status-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    font-weight: 500;
}

/* ===== 区域天气条 ===== */
#weatherBar {
    display: none;
    align-items: center;
    gap: 10px;
    margin-left: auto;          /* 筛选栏内推到最右 */
    padding: 5px 12px;
    background: linear-gradient(135deg, #e8f4fd, #f0f8ff);
    border: 1px solid rgba(22,119,255,.15);
    border-radius: 20px;
    font-size: 12px;
    white-space: nowrap;
    flex-wrap: wrap;
}
.weather-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: help;
    color: #333;
}
.weather-item + .weather-item::before {
    content: '|';
    color: #c9d6e2;
    margin-right: 6px;
}
.weather-city { font-weight: 600; color: #1677ff; }
.weather-emoji { font-size: 15px; }
.weather-temp { font-weight: 700; color: #1f1f1f; }
.weather-desc { color: #666; }

/* ===== 未来15天预报浮层(2026-10: 悬停/点击天气卡城市块查看; 自适应宽度, 完整展示) ===== */
#wx15Tip {
    position: fixed;
    z-index: 9999;
    width: 640px;
    max-width: calc(100vw - 24px);
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.14);
    padding: 12px 14px;
    font-size: 12px;
    color: #333;
    display: none;
}
#wx15Tip .wx15-head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 14px;
    color: #1f1f1f;
    padding-bottom: 8px;
    margin-bottom: 8px;
    border-bottom: 1px dashed #eee;
}
/* 区块小标题(近9天实况/未来预报) */
#wx15Tip .wx15-sec {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 13px;
    color: #1677ff;
    padding: 4px 0;
    margin-top: 4px;
}
/* 近9天实况: 蓝灰冷调(过去式, 与主蓝UI协调; 今天行 JS 内联蓝底) */
#wx15Tip .wx15-grid.his .wx15-day {
    background: #f3f7fc;
    border: 1px solid #e5edf7;
}
#wx15Tip .wx15-grid.his .wx15-day:hover {
    background: #eaf2fb;
}
#wx15Tip .wx15-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 4px 12px;
    max-height: 62vh;
    overflow-y: auto;
}
#wx15Tip .wx15-day {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 6px;
    white-space: nowrap;
    min-width: 0;
}
#wx15Tip .wx15-day:nth-child(odd) { background: #fafbfc; }
#wx15Tip .wx15-date { min-width: 74px; color: #8c8c8c; }
#wx15Tip .wx15-date b { color: #1f1f1f; }
#wx15Tip .wx15-desc {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #595959;
}
#wx15Tip .wx15-t { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }
#wx15Tip .wx15-t .hi { color: #fa541c; }
#wx15Tip .wx15-t .lo { color: #1677ff; margin-left: 6px; }
#wx15Tip .wx15-hint {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px dashed #eee;
    font-size: 11px;
    color: #bbb;
}
/* 窄屏(手机/小窗): 浮层收窄为整屏宽, 网格自动降为单列, 数据完整不截断 */
@media (max-width: 700px) {
    #wx15Tip {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
    }
}

/* ===== 开关(switch) ===== */
.switch-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}
.switch-label input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.switch-label .switch {
    position: relative;
    width: 36px;
    height: 20px;
    background: #d9d9d9;
    border-radius: 999px;
    transition: background 0.25s;
    flex-shrink: 0;
}
.switch-label .switch::after {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    transition: transform 0.25s;
}
.switch-label input:checked + .switch {
    background: var(--primary);
}
.switch-label input:checked + .switch::after {
    transform: translateX(16px);
}

/* ===== 图表网格 ===== */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.25s;
}
.chart-card:hover { box-shadow: var(--shadow-hover); }
.chart-card.full-width {
    grid-column: 1 / -1;
}
.chart-card .chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.chart-card .chart-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.chart-card .chart-subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}
.chart-container {
    width: 100%;
    height: 320px;
}
.chart-container.tall {
    height: 400px;
}

/* ===== 同比指标块 ===== */
.yoy-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}
.yoy-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
    border-left: 3px solid transparent;
    transition: all 0.25s;
}
.yoy-card:nth-child(1) { border-left-color: var(--primary); }
.yoy-card:nth-child(2) { border-left-color: #13c2c2; }
.yoy-card:hover { box-shadow: var(--shadow-hover); }
.yoy-card .yoy-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}
.yoy-item {
    display: grid;
    grid-template-columns: 80px minmax(96px, auto) 1fr;
    align-items: baseline;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
}
.yoy-item:last-child { border-bottom: none; }
.yoy-item .yoy-label {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}
.yoy-item .yoy-value {
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}
.yoy-item .yoy-detail {
    font-size: 12px;
    color: #8c8c8c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.yoy-value.up { color: var(--success); }
.yoy-value.down { color: var(--danger); }

/* ===== 通用弹窗(统一) ===== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s ease;
}
.modal-overlay.show { display: flex; opacity: 1; }
.modal-box {
    background: #fff;
    border-radius: 14px;
    width: min(880px, 94vw);
    max-height: 84vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
    transform: translateY(16px) scale(0.96);
    transition: transform .25s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}
.modal-overlay.show .modal-box { transform: translateY(0) scale(1); }
/* 自适应宽度弹窗: 随内容(表格)宽度伸缩 */
.modal-box.modal-auto {
    width: max-content;
    min-width: 680px;
    max-width: 94vw;
}
.modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f8faff 0%, #fff 100%);
    flex-shrink: 0;
}
.modal-title { font-size: 16px; font-weight: 600; color: #1f1f1f; }
.modal-close {
    border: none;
    background: #f5f5f5;
    border-radius: 8px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 16px;
    color: #8c8c8c;
    transition: all .2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-close:hover { background: #ff4d4f; color: #fff; }
.modal-body { padding: 16px 24px 20px; overflow: auto; position: relative; max-height: 72vh; }
.modal-body table.data-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fafafa;
}
.modal-body table.data-table th,
.modal-body table.data-table td { text-align: center; }
.modal-body table.data-table th.num,
.modal-body table.data-table td.num { text-align: right; }
.modal-summary {
    margin-bottom: 14px;
    text-align: center;
    color: #595959;
    font-size: 13px;
    background: #f7f9fc;
    border-radius: 8px;
    padding: 8px 12px;
}
.modal-summary b { color: #1677ff; margin: 0 2px; }

/* 弹窗内加载占位(钻取弹窗先展示加载态, 数据到达后替换) */
.modal-loading {
    text-align: center;
    padding: 44px 20px;
    color: #1677ff;
    font-size: 13px;
    font-weight: 500;
    animation: loading-pulse 1.2s ease-in-out infinite;
}
@keyframes loading-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
}

/* 卡片标题 emoji 悬停说明(鼠标悬停显示功能/字段/预期作用) */
.card-help {
    cursor: help;
    border-radius: 4px;
    transition: background 0.15s, box-shadow 0.15s;
}
.card-help:hover {
    background: #e6f4ff;
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}

/* ===== 数据表格 ===== */
/* 通用小标签页按钮(维度切换, 如 按门店/按导购) */
.purchase-tab {
    border: 1px solid var(--border);
    background: #fff;
    color: #595959;
    border-radius: 6px;
    padding: 5px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.purchase-tab:hover { border-color: var(--primary); color: var(--primary); }
.purchase-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
/* VIP卡号链接(点击查看历史消费) */
.vip-card-link { color: var(--primary); cursor: pointer; font-weight: 600; border-bottom: 1px dashed var(--primary); }
.vip-card-link:hover { color: #0958d9; }
.data-table-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow 0.25s;
}
.data-table-card:hover { box-shadow: var(--shadow-hover); }
.data-table-card .chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    gap: 12px;
    flex-wrap: wrap;
}
.data-table-card .chart-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.data-table-wrap {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 480px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
table.data-table {
    width: 100%;
    /* border-collapse: collapse 与 position:sticky 表头组合在滚动时列会错位,
       改用 separate + spacing:0 修复 */
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}
table.data-table th {
    background: #f7f9fc;
    padding: 12px 16px;
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    position: sticky;
    top: 0;
    /* separate模式+滚动时需更高z-index确保表头盖住数据行 */
    z-index: 2;
    border-bottom: 2px solid #e2e6ee;
    white-space: nowrap;
    letter-spacing: 0.2px;
}
table.data-table th .dim-note {
    color: #e6a23c;
    font-weight: 700;
    margin-left: 2px;
    cursor: help;
}
table.data-table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}
table.data-table tbody tr:nth-child(even) td {
    background: #fafbfc;
}
table.data-table tbody tr:hover td {
    background: #f0f6ff;
}
table.data-table tbody tr:last-child td {
    border-bottom: none;
}
table.data-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}
table.data-table th.num {
    text-align: right;
}
table.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.15s;
}
table.data-table th.sortable:hover {
    color: var(--primary);
}
table.data-table th .sort-arrow {
    font-size: 10px;
    color: var(--primary);
    margin-left: 2px;
}
table.data-table td.empty-cell {
    text-align: center;
    color: #8c8c8c;
    padding: 24px 16px;
    font-size: 13px;
}
table.data-table tbody tr.clickable {
    cursor: pointer;
    transition: background 0.15s;
}
table.data-table tbody tr.clickable:hover td {
    background: #e8f1ff;
}
table.data-table td .badge + .badge { margin-left: 4px; }
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}
.badge.success { background: #f6ffed; color: var(--success); border: 1px solid #b7eb8f; }
.badge.warning { background: #fffbe6; color: var(--warning); border: 1px solid #ffe58f; }
.badge.danger { background: #fff2f0; color: var(--danger); border: 1px solid #ffccc7; }
.badge.info { background: #f0f5ff; color: var(--primary); border: 1px solid #adc6ff; }

/* ===== 钻取面包屑 ===== */
.drill-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}
.drill-breadcrumb .crumb {
    cursor: pointer;
    color: var(--primary);
    font-weight: 500;
}
.drill-breadcrumb .crumb:hover {
    text-decoration: underline;
}
.drill-breadcrumb .separator {
    color: var(--border);
}

/* ===== 加载中 ===== */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}
.spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 3px solid rgba(22,119,255,0.15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 60px 0;
    color: var(--text-secondary);
    font-size: 13px;
}
/* VIP分析切换加载遮罩(带emoji) */
.vip-loading {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    animation: fadeIn 0.2s ease;
}
.vip-loading-box {
    background: #fff;
    border-radius: 16px;
    padding: 28px 44px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    box-shadow: 0 16px 48px rgba(0,0,0,0.18);
    animation: zoomIn 0.25s ease;
    line-height: 1.7;
}
.vip-loading-sub {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-top: 6px;
}
/* 组件内 品牌/门店/导购 联动筛选条 */
.vip-filter-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 10px 14px;
    margin-bottom: 12px;
    background: #f8faff;
    border: 1px solid #eef1f6;
    border-radius: 10px;
}
.vip-filter-bar .multi-select {
    min-width: 150px;
    max-width: 200px;
    height: 34px;
    font-size: 12px;
}
/* 页面级加载遮罩(emoji版, 兼容 Win/Mac) */
.page-loading {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(240,242,245,0.7);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    transition: opacity 0.3s;
}
.page-loading-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 16px;
    padding: 30px 48px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
    animation: zoomIn 0.25s ease;
}
.page-loading-emoji {
    font-size: 44px;
    line-height: 1;
    animation: loading-bounce 1.6s ease-in-out infinite;   /* 2026-09 放慢: 0.9s → 1.6s, 减少跳动频率 */
}
.page-loading-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.page-loading-sub {
    font-size: 12px;
    color: var(--text-secondary);
}
@keyframes loading-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }   /* 2026-09 幅度 7px→5px, 更柔和 */
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-secondary);
    font-size: 13px;
}
.empty-state .empty-icon {
    font-size: 40px;
    margin-bottom: 10px;
    opacity: 0.55;
}

/* ===== 共享动画 keyframes(vip-loading / page-loading-box 使用) ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoomIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: scale(1); } }

/* ===== 滚动条 ===== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d9d9d9; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #bfbfbf; }

/* ===== 商品图片悬停(2026-09 由 products.html 提到公共层, 商品/库存等页共用) =====
   .img-hover  = 悬停热区(里面可以放缩略图, 也可以只放文字 + 一个隐藏的 .hover-img)
   .hover-img  = 隐藏的原图, 悬停时由 #hoverImgLayer 克隆放大展示(见 common.js)
   注意: .hover-img 只在其父级 .img-hover 内隐藏; 浮层里的克隆节点不受此规则影响 */
.img-hover { position: relative; display: inline-block; cursor: pointer; }
.img-hover .hover-img { display: none; }
#hoverImgLayer img { display: block; }

/* ===== 响应式 ===== */
@media (max-width: 1200px) {
    .charts-grid { grid-template-columns: 1fr; }
}

/* ===== 移动端(手机/钉钉H5) ===== */
@media (max-width: 768px) {
    /* 顶部导航: 压缩高度 + 横向滚动 + 刘海安全区 */
    .navbar {
        height: 50px;
        padding: 0 8px;
        padding-top: env(safe-area-inset-top, 0px);
    }
    .navbar .logo { margin-right: 10px; font-size: 14px; letter-spacing: 0; }
    .navbar .nav-tabs {
        gap: 4px;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .navbar .nav-tabs::-webkit-scrollbar { display: none; }
    .navbar .nav-tab { padding: 6px 9px; font-size: 12px; flex-shrink: 0; white-space: nowrap; }
    .navbar .nav-right { gap: 6px; }
    .navbar .refresh-btn { padding: 4px 8px; font-size: 12px; }
    .navbar .nav-user { display: none; }  /* 移动端隐藏用户名, 省空间 */

    /* 内容区 + 底部安全区(全面屏手势条) */
    .main-content {
        padding: 10px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
    .page-header { margin-bottom: 10px; }
    .page-header h1 { font-size: 17px; }
    .page-header p { font-size: 12px; }

    /* 统计卡: 双列紧凑(4卡=2行), 禁用桌面悬浮位移 */
    .stats-row { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
    .stat-card { padding: 12px 13px; }
    .stat-card .stat-label { font-size: 12px; margin-bottom: 6px; }
    .stat-card .stat-value { font-size: 19px; }
    .stat-card .stat-unit { font-size: 12px; }
    .stat-card:hover { transform: none; box-shadow: var(--shadow); }

    /* 同比卡片 */
    .yoy-grid { grid-template-columns: 1fr; gap: 8px; }

    /* 筛选栏: 自动换行, 控件全宽便于点按 */
    .filter-bar { padding: 10px 12px; gap: 8px; }
    .filter-item { flex: 1 1 45%; min-width: 0; }
    .filter-item label { font-size: 12px; }
    .filter-item select, .filter-item input {
        width: 100%;
        min-width: 0;
        height: 36px;          /* 触控友好高度 */
        font-size: 13px;
    }

    /* 表格: 容器横向滑动(保持列宽不破版) */
    .data-table-wrap { overflow-x: auto !important; -webkit-overflow-scrolling: touch; }
    .data-table { min-width: 640px; }
    .data-table th, .data-table td { padding: 8px 10px; font-size: 12px; }

    /* 弹窗: 全屏化(移动端下钻体验) */
    .modal-overlay { padding: 0; }
    /* 2026-10-01 修复: 必须连 .modal-auto 一起写 —— 桌面端 `.modal-box.modal-auto` 有
       `min-width: 680px`, 而它的选择器优先级(两个类)高于这里的 `.modal-box`(一个类),
       所以手机上弹窗仍被撑到 680px(屏宽才 375px) → 钻取弹窗内容被裁切/横向溢出。
       这正是用户反馈"钻取在手机上显示不合适"的直接原因。 */
    .modal-box,
    .modal-box.modal-auto {
        width: 100vw;
        max-width: 100vw;
        min-width: 0;           /* 关键: 覆盖 680px 最小宽度 */
        height: 100vh;          /* 旧WebView兜底 */
        max-height: 100vh;
        height: 100dvh;         /* 新内核优先(地址栏动态收缩) */
        max-height: 100dvh;
        border-radius: 0;
    }
    .modal-body {
        flex: 1;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        padding: 12px;
        /* 2026-10-01: 桌面端有 max-height:72vh, 全屏弹窗下会留出 28% 空白 → 手机上放开 */
        max-height: none;
    }

    /* 图表卡: 紧凑间距 */
    .charts-grid { gap: 8px; }
    .chart-card { padding: 12px; }
    .chart-header { flex-wrap: wrap; gap: 6px; }
    .chart-subtitle { font-size: 11px !important; }

    /* 图表高度: 移动端统一压缩(矮图更适合手机纵向浏览) */
    .chart-container { height: 240px !important; }
    #chartMap { height: 320px !important; }
    #chartDaily { height: 300px !important; }

    /* 地图: 移动端改为上下堆叠(图+城市列表) */
    .map-city-side { width: 100%; max-height: 240px; }

    /* 触控目标: 按钮不小于 34px 高 */
    .btn, .btn-export, .purchase-tab, .refresh-btn, .check-dropdown .cd-trigger {
        min-height: 34px;
    }

    /* 移动端卡片列表(替代表格) */
    .mobile-card {
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 10px;
        padding: 12px;
        margin-bottom: 8px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.04);
        transition: background 0.15s;
    }
    .mobile-card:active { background: #f5f8ff; }
    .mobile-card .mc-title {
        display: flex;
        justify-content: space-between;
        align-items: center;
        font-size: 14px;
        font-weight: 600;
        margin-bottom: 8px;
        gap: 6px;
        word-break: break-all;
    }
    .mobile-card .mc-row {
        display: flex;
        justify-content: space-between;
        gap: 10px;
        font-size: 12px;
        color: var(--text-secondary);
        padding: 2px 0;
    }
    .mobile-card .mc-row b { color: var(--text-primary); font-weight: 600; }
    .mobile-card .mc-metrics {
        display: flex;                 /* 用 flex 而非 grid: 钉钉旧WebView对grid支持不佳, flex兼容更广 */
        flex-wrap: wrap;
        gap: 6px;
        margin-top: 8px;
    }
    .mobile-card .mc-metric {
        flex: 1 1 30%;
        min-width: 80px;
        background: #f7f9fc;
        border-radius: 8px;
        padding: 6px 4px;
        text-align: center;
        box-sizing: border-box;
    }
    .mobile-card .mc-metric .v {
        font-weight: 700;
        font-size: 12.5px;
        line-height: 1.35;
        word-break: break-all;   /* 长金额换行而非截断成"123,45..." */
    }
    .mobile-card .mc-metric .l { font-size: 10px; color: var(--text-secondary); margin-top: 2px; }

    /* 移动端卡片折叠(2026-09 ★2「低频卡片收起」):
       data-mobile-collapse 的卡片在手机上默认收起, 标题右侧出现「展开」按钮 ——
       管理类/配置类/审计类卡片(权限矩阵、免密名单、操作日志等)平时不需要看,
       默认收起可让手机首屏直接看到高频内容。桌面端不受影响。 */
    .mc-collapse-body.is-collapsed { display: none; }
    .mc-collapse-btn {
        font-size: 12px;
        padding: 3px 10px;
        min-height: 28px;
        background: #f5f8ff;
        border: 1px solid #dbe6ff;
        color: #1677ff;
        border-radius: 6px;
        cursor: pointer;
        flex-shrink: 0;
    }
    .mc-collapse-btn:active { background: #e8f0ff; }
    .card-title-note { display: none; }
    .mc-collapsed-note {
        font-size: 11px;
        color: #8c8c8c;
        padding: 2px 0 4px;
    }

    /* 移动端隐藏辅助说明长文, 减少滚动长度 */
    .card-help { display: none; }
}

/* 超小屏(≤400px): 筛选控件单列 */
@media (max-width: 400px) {
    .filter-item { flex: 1 1 100%; }
    .stats-row { grid-template-columns: 1fr 1fr; }
}

/* 导出过渡动画: 包裹图标上下跳动 */
@keyframes exportBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-14px); }
}

/* ===== 复选框下拉组件(check-dropdown) ===== */
.check-dropdown {
    position: relative;
    display: inline-block;
}
/* 联动禁用态: 未选上级时下级灰显不可点(品牌未选->门店/导购禁用; 门店未选->导购禁用) */
.check-dropdown.disabled {
    opacity: 0.45;
    pointer-events: none;
    cursor: not-allowed;
}
.check-dropdown .cd-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 150px;
    max-width: 220px;
    height: 34px;
    padding: 6px 12px;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    font-size: 12px;
    background: #fff;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    white-space: nowrap;
    overflow: hidden;
    user-select: none;
}
.check-dropdown .cd-trigger:hover {
    border-color: var(--primary);
}
.check-dropdown.open .cd-trigger {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.12);
}
.check-dropdown .cd-trigger .cd-label {
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}
.check-dropdown .cd-trigger .cd-arrow {
    flex-shrink: 0;
    transition: transform 0.2s;
    color: #8c8c8c;
    font-size: 10px;
}
.check-dropdown.open .cd-trigger .cd-arrow {
    transform: rotate(180deg);
}
.check-dropdown .cd-panel {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 100%;
    width: max-content;
    max-width: 320px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 100;
    overflow: hidden;
}
.check-dropdown.open .cd-panel {
    display: block;
}
.check-dropdown .cd-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 12px;
}
.check-dropdown .cd-panel-header a {
    color: var(--primary);
    cursor: pointer;
    text-decoration: none;
}
.check-dropdown .cd-panel-header a:hover {
    text-decoration: underline;
}
.check-dropdown .cd-options {
    max-height: 240px;
    overflow-y: auto;
    padding: 4px 0;
}
.check-dropdown .cd-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}
.check-dropdown .cd-option:hover {
    background: #f5f7fa;
}
.check-dropdown .cd-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}
.check-dropdown .cd-option .cd-option-text {
    overflow: hidden;
    text-overflow: ellipsis;
}
.check-dropdown .cd-option.disabled {
    color: #bbb;
    cursor: not-allowed;
}
.check-dropdown .cd-option.disabled input {
    cursor: not-allowed;
}
.vip-filter-bar .cd-confirm-btn {
    padding: 7px 18px;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    background: var(--primary);
    color: #fff;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}
.vip-filter-bar .cd-confirm-btn:hover {
    background: #4096ff;
}
.vip-filter-bar .cd-confirm-btn:active {
    transform: scale(0.97);
}
.vip-filter-bar .cd-dim-hint {
    font-size: 12px;
    color: var(--text-secondary);
    background: #e6f4ff;
    border: 1px solid #bae0ff;
    border-radius: 6px;
    padding: 3px 10px;
    white-space: nowrap;
}

/* Twemoji 彩色静态 emoji 图标(2026-09-06): 文本 emoji 替换后统一尺寸对齐 */
img.twemoji {
    width: 1.05em;
    height: 1.05em;
    vertical-align: -0.15em;
    display: inline-block;
    margin: 0 0.06em;
}
img.twemoji.twemoji-lg {
    width: 1.4em;
    height: 1.4em;
    vertical-align: -0.3em;
}
/* 卡片标题/大字号场景放大一档 */
.chart-title img.twemoji,
.stat-label img.twemoji,
.card-help img.twemoji {
    width: 1.15em;
    height: 1.15em;
    vertical-align: -0.18em;
}

/* ===== 勾选式选择器(人员数据范围/预警接收人配置, 2026-09-18) =====
   用户反馈: 原来的 <select multiple> 又矮又要按住 Ctrl 点, 挑 200 多家门店/几十号人很费劲。
   现改为「可滚动的打钩列表 + 关键字筛选 + 一键全选当前结果」。
   高度: 后台配置基本在 PC 端做, 故桌面端给到 440px(一屏能看到 15+ 项), 手机端收窄到 300px 防止挤掉正文。 */
.scope-pick-list {
    max-height: 440px;
    min-height: 150px;
    overflow: auto;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 4px 6px;
    background: #fff;
}
.scope-pick-list .scope-pick-sec + .scope-pick-sec { margin-top: 4px; }
.scope-pick-grp {
    font-size: 11px;
    font-weight: 600;
    color: #8c8c8c;
    margin: 4px 0 2px;
    padding: 2px 4px;
    background: #f7f9fc;
    border-radius: 4px;
    position: sticky;
    top: -4px;
}
.scope-pick-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #333;
    padding: 3px 4px;
    border-radius: 4px;
    cursor: pointer;
    user-select: none;
}
.scope-pick-row:hover { background: #f0f6ff; }
.scope-pick-row input[type="checkbox"] { flex-shrink: 0; width: 14px; height: 14px; cursor: pointer; }
/* 权限组卡片折叠(2026-09-18): 组多时先折起来看清有哪些组, 点标题栏展开;
   折叠状态由 JS 存在组对象上(_open), 重绘不丢。 */
.scope-gcard {
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    margin-bottom: 10px;
    background: #fcfcfc;
    overflow: hidden;
}
.scope-gcard.is-open { border-color: #dbe6ff; }
.scope-gcard-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 12px;
    cursor: pointer;
    user-select: none;
    background: #f7f9fc;
}
.scope-gcard.is-open .scope-gcard-head { background: #f0f6ff; }
.scope-gcard-head:hover { background: #eaf2ff; }
.scope-gcard-caret { color: #1677ff; font-size: 12px; width: 12px; flex-shrink: 0; }
.scope-gcard-no { font-weight: 600; color: #333; flex-shrink: 0; }
.scope-gcard-sum { font-size: 12px; color: #8c8c8c; white-space: nowrap; }
.scope-gcard-body { padding: 10px 12px 12px; }
@media (max-width: 768px) {
    /* 手机上标题栏会换行, 摘要单独占一行更清楚 */
    .scope-gcard-sum { white-space: normal; flex: 1 1 100%; }
}

/* 勾选态加粗, 便于一眼看清已选(200+ 项时尤其重要)
   注: 这里用 JS 维护的 .is-picked 而不是 :has() —— 钉钉内置 WebView 版本较老,
       :has() 在旧 WKWebView 上不支持会整条失效(见 logs.html scopePick) */
.scope-pick-row.is-picked { background: #f6ffed; }
.scope-pick-row.is-picked span { font-weight: 600; color: #1677ff; }
@media (max-width: 768px) {
    .scope-pick-list { max-height: 320px; min-height: 120px; }
}


/* ===== 二级菜单(运营数据等分组; 2026-10-10) ===== */
.nav-group { position: relative; display: inline-flex; align-items: center; }
.nav-group-btn {
    display: inline-flex; align-items: center; gap: 3px;
    padding: 7px 12px; border-radius: 8px; cursor: pointer;
    font-size: 13.5px; color: rgba(255,255,255,0.85); white-space: nowrap;
    transition: background .15s, color .15s;
}
.nav-group-btn:hover, .nav-group.open .nav-group-btn { background: rgba(255,255,255,0.14); color: #fff; }
.nav-group.active .nav-group-btn { background: rgba(255,255,255,0.20); color: #fff; font-weight: 600; }
.nav-caret { font-size: 10px; opacity: .75; }
.nav-group-menu {
    display: none; position: absolute; top: calc(100% + 8px); left: 0; z-index: 3000;
    min-width: 176px; padding: 6px; background: #fff; border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #f0f0f0;
}
.nav-group.open .nav-group-menu { display: block; }
.nav-tab-sub {
    display: block; padding: 9px 12px; border-radius: 8px; color: #1f1f1f;
    font-size: 13.5px; text-decoration: none; white-space: nowrap;
    transition: background .15s, color .15s;
}
.nav-tab-sub:hover { background: #f0f6ff; color: var(--primary); }
.nav-tab-sub.active { background: rgba(22,119,255,.10); color: var(--primary); font-weight: 600; }

/* 移动端: 二级菜单改为底部抽屉(触屏上 hover 不可用) */
@media (max-width: 768px) {
    .nav-group-menu {
        position: fixed; top: auto; left: 0; right: 0; bottom: 0;
        min-width: 0; border-radius: 16px 16px 0 0;
        padding: 8px 8px calc(10px + env(safe-area-inset-bottom, 0px));
        box-shadow: 0 -10px 32px rgba(0,0,0,0.22);
        animation: navSheetUp .18s ease-out;
    }
    .nav-group-menu::before {
        content: ''; display: block; width: 38px; height: 4px; margin: 2px auto 8px;
        background: #e0e0e0; border-radius: 2px;
    }
    .nav-tab-sub { padding: 13px 14px; font-size: 15px; }
    .nav-group-btn { padding: 6px 9px; font-size: 12px; }
}
@keyframes navSheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
