/* ============================================================
   仓库库存看板 · 全局样式（像素级对齐参考图）
   ============================================================ */

/* ---------- CSS 变量 ---------- */
:root {
    /* 主题色 */
    --primary: #1677ff;
    --primary-light: #e7f0ff;
    --primary-dark: #0958d9;

    /* 看板渐变 */
    --banner-start: #1677ff;
    --banner-end: #4096ff;

    /* 功能色 */
    --success: #16a34a;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;

    /* 文字色 */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-sky-600: #0084d1;

    /* 背景 */
    --bg-page: #f5f7fb;
    --bg-white: #ffffff;
    --bg-gray: #f3f4f6;
    --border: #e5e7eb;
    --border-light: #eef0f4;
    --bg-sky-50: #f0f9ff;

    /* 圆角 */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 999px;

    /* 阴影 */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 20px 48px rgba(0, 0, 0, 0.15);
    --tw-inset-shadow {
        syntax: "*";
        inherits: false;
        initial-value: 0 0 #0000;
    }
    --tw-inset-ring-shadow {
        syntax: "*";
        inherits: false;
        initial-value: 0 0 #0000;
    }
    --tw-ring-offset-shadow {
        syntax: "*";
        inherits: false;
        initial-value: 0 0 #0000;
    }
    --tw-ring-shadow {
        syntax: "*";
        inherits: false;
        initial-value: 0 0 #0000;
    }

    /* 尺寸 */
    --sidebar-w: 220px;
    --tabbar-h: 60px;
    --max-content: 48rem; /* ≈ 768px：中间区域统一宽度 */

    /* 字号层级 */
    --fs-10: 10px;
    --fs-11: 11px;
    --fs-12: 12px;
    --fs-13: 13px;
    --fs-14: 14px;
    --fs-15: 15px;
    --fs-16: 16px;
    --fs-18: 18px;
    --fs-20: 20px;
    --fs-22: 22px;
    --fs-24: 24px;
    --fs-26: 26px;
    --fs-28: 28px;
    --fs-32: 32px;
}

/* ---------- Reset ---------- */
*, *::before, *::after {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
                 "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: var(--fs-14);
    color: var(--text-primary);
    background: var(--bg-page);
    height: 100%;
    height: 100vh;
    -webkit-text-size-adjust: 100%;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; }

/* ============================================================
   整体布局
   ============================================================ */
body {
    display: flex;
    position: fixed;
    inset: 0;
    overflow: hidden;
}

/* PC 侧边栏 */
.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: #ffffff;
    border-right: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    z-index: 20;
}

/* PC 主内容区：右侧自适应，padding 24px 天然提供左右距离 */
.main-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px 24px 32px;
}

/* 所有内容块都 100% 铺满 main-content，不做强制居中限制 */
.main-content > .board,
.main-content > .content-panel,
.main-content > .page-head,
.main-content > .filter-panel,
.main-content > .history-table-wrap {
    width: 100%;
}

/* ============================================================
   PC 侧边栏细节
   ============================================================ */

/* logo 区：深蓝渐变 + 白色文字（标题行 + 版本号纵向排列） */
.sidebar-logo {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 14px 20px;
    font-weight: 600;
    font-size: var(--fs-16);
    color: #ffffff;
    background: linear-gradient(135deg, #1677ff 0%, #4096ff 100%);
    min-height: 60px;
}
.sidebar-logo-main {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-logo i { font-size: 22px; }

/* 版本号：logo 标题下方，白色半透明小字 */
.sidebar-version {
    font-size: 11px;
    font-weight: 400;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.75);
}

/* 导航 */
.sidebar-nav {
    flex: 1;
    padding: 14px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.sidebar-nav .nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: var(--fs-14);
    min-height: 44px;
    transition: background 0.15s, color 0.15s;
}
.sidebar-nav .nav-item i {
    font-size: 15px;
    width: 20px;
    text-align: center;
}
.sidebar-nav .nav-item:hover { background: var(--bg-gray); color: var(--text-primary); }

/* active：深蓝渐变底 + 白色 */
.sidebar-nav .nav-item.active {
    background: var(--bg-sky-50);
    color: var(--text-sky-600);
    font-weight: 500;
}
.sidebar-nav .nav-item.active::before {
    content: "";
    position: absolute;
    left: 180px;
    top: 50%;
    transform: translateY(-50%);
    width: 6px;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--text-sky-600);
}

/* 底部用户信息 */
.sidebar-user {
    border-top: 1px solid var(--border-light);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
}
.sidebar-user .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.sidebar-user .user-info > i { font-size: 26px; color: var(--text-muted); flex-shrink: 0; }

/* 移动端顶部用户条（PC 隐藏，≤767px 显示） */
.mobile-userbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin-bottom: 4px;
    position: relative;
    z-index: 100;
    overflow: visible;
}
.mobile-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.mobile-user-info > i { font-size: 22px; color: var(--text-muted); flex-shrink: 0; }
.mobile-user-name {
    font-size: var(--fs-14);
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.mobile-logout-btn {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .15s ease, color .15s ease;
}
.mobile-logout-btn:active { background: var(--bg-gray); color: var(--danger); }

/* 用户下拉菜单 */
.user-dropdown {
    position: absolute;
    left: 16px;
    bottom: 72px;
    width: 180px;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    z-index: 50;
    overflow: hidden;
}
.user-dropdown.mobile {
    position: absolute;
    top: calc(100% + 4px);
    left: 12px;
    width: 160px;
    height: 180px;
    z-index: 101;
}
.dropdown-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
}
.dropdown-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: var(--primary);
}
.dropdown-user-info { flex: 1; min-width: 0; }
.dropdown-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.dropdown-role { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.dropdown-divider { height: 1px; background: var(--border-light); margin: 0 12px; }
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
    transition: background .15s;
}
.dropdown-item:hover { background: var(--bg-gray); }
.dropdown-item i { width: 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

.user-name { font-size: var(--fs-13); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: var(--fs-12); color: var(--text-muted); }

.logout-btn {
    width: 40px; height: 40px;
    min-width: 44px; min-height: 44px;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
}
.logout-btn:hover { background: var(--bg-gray); color: var(--danger); }

/* ============================================================
   看板（两个页面通用）
   ============================================================ */
.board {
    background: linear-gradient(135deg, var(--banner-start) 0%, var(--banner-end) 100%);
    border-radius: var(--radius-2xl);
    padding: 20px 24px 18px;
    color: #ffffff;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: 0 6px 24px rgba(26, 86, 219, 0.25);
}

.board-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.board-title {
    margin: 0;
    font-size: var(--fs-18);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}
.board-title i { font-size: 22px; }
.board-date { font-size: var(--fs-13); opacity: 0.90; }

/* stat 卡片网格 */
.board-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 18px;
    overflow: hidden;
}
.stat-card {
    background: rgba(255, 255, 255, 0.20);
    border-radius: var(--radius-lg);
    padding: 14px 25px;
    display: grid;
    min-height: 82px;
    backdrop-filter: blur(2px);
    &:hover {
        scale: 1.02;
        transition: transform 0.3s ease;
    }
}
.stat-icon {
    font-size: 16px;
}
.stat-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
}
.stat-label {
    font-size: var(--fs-12);
    opacity: 0.90;
    line-height: 1.2;
}
.stat-value {
    font-size: var(--fs-28);
    font-weight: 700;
    line-height: 1.1;
    color: #ffffff;
    white-space: nowrap;
}
.stat-value .stat-unit {
    font-size: var(--fs-13);
    font-weight: 400;
    margin-left: 2px;
    opacity: 0.92;
}
.stat-value.warning { color: #ff7875; }
.stat-value.warning .stat-unit { 
    color: #fff;
    /* color: #ffd1c2;  */
}

/* 进度条 */
.board-bar { padding: 0; }
.bar-label {
    font-size: var(--fs-13);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    opacity: 0.95;
}
.bar-value { font-weight: 600; }
.bar-track {
    background: rgba(255, 255, 255, 0.28);
    border-radius: var(--radius-full);
    height: 6px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, #ff8a6b 0%, #ff4b4b 100%);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

/* 仓库看板：分类网格 section */
.dashboard-section {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 18px 20px 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}
.dashboard-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}
.dashboard-section-header h3 {
    font-size: var(--fs-16);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.dashboard-section-header h3 i {
    color: var(--primary);
}
.section-tip {
    font-size: var(--fs-13);
    color: var(--text-secondary);
}

/* 分类卡片网格 */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.cat-card {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 16px;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: box-shadow 0.2s, transform 0.15s, border-color 0.2s;
    cursor: pointer;
}
.cat-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
    transform: translateY(-1px);
}
.cat-card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-weight: 500;
}
.cat-card-head i { font-size: 16px; }
.cat-card-name {
    font-size: var(--fs-15);
    color: var(--text-primary);
    font-weight: 600;
}
.cat-card-body {
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.cat-card-count {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.cat-card-unit {
    font-size: var(--fs-13);
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 2px;
}
.cat-card-warn {
    font-size: var(--fs-13);
    color: #ef4444;
    display: flex;
    align-items: center;
    gap: 4px;
}
.cat-card-ok {
    font-size: var(--fs-13);
    color: #52c41a;
    display: flex;
    align-items: center;
    gap: 4px;
}
.cat-card-foot {
    margin-top: auto;
    font-size: var(--fs-13);
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: flex-end;
    opacity: 0.85;
}
.cat-card:hover .cat-card-foot { opacity: 1; }

/* 看板进度条（dashboard 专用） */
.board-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}
.board-bar-label {
    font-size: var(--fs-13);
    opacity: 0.90;
    flex-shrink: 0;
}
.board-bar-track {
    flex: 1;
    background: rgba(255,255,255,0.25);
    border-radius: var(--radius-full);
    height: 6px;
    overflow: hidden;
    min-width: 80px;
}
.board-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffd666 0%, #ff7875 100%);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}
.board-bar-value {
    font-size: var(--fs-13);
    font-weight: 600;
    flex-shrink: 0;
}

/* ============================================================
   白色内容面板（搜索 + 列表头 + 卡片网格）
   ============================================================ */
.content-panel {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 14px 18px 20px;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

/* 工具栏（搜索 + 筛选 + 重置） */
.toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 6px;
}
.search-wrap {
    flex: 1;
    position: relative;
    min-width: 200px;
    --tw-shadow: 0 2px 8px var(--tw-shadow-color, rgba(22, 119, 255, 0.06));
    box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
}
.search-wrap i {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.search-wrap input {
    width: 100%;
    height: 44px;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 44px 0 40px;
    font-size: var(--fs-14);
    /* background: var(--bg-gray); */
    transition: border 0.15s, background 0.15s;
}
.search-wrap input:focus {
    outline: none;
    /* border-color: var(--primary); */
    background: var(--bg-white);
}
.search-wrap .icon-btn {
    position: absolute;
    right: 4px; top: 50%;
    transform: translateY(-50%);
}

.filter-wrap { display: flex; align-items: center; gap: 8px; }
.filter-wrap .reset-btn {
    color: var(--text-muted);
    font-size: var(--fs-13);
    padding: 8px 12px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
}
.filter-wrap .reset-btn:hover { background: var(--bg-gray); color: var(--primary); }

/* Switch（只看预警） */
.switch {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    min-height: 36px;
    color: var(--text-secondary);
    font-size: var(--fs-13);
}
.switch input { display: none; }
.switch .slider {
    width: 40px; height: 22px;
    background: #d1d5db;
    border-radius: var(--radius-full);
    position: relative;
    transition: background 0.2s;
    flex-shrink: 0;
}
.switch .slider::before {
    content: "";
    position: absolute;
    width: 18px; height: 18px;
    top: 2px; left: 2px;
    background: #fff;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* 列表头：数量 + FAB */
.list-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin: 12px 2px 14px;
    color: var(--text-secondary);
    font-size: var(--fs-13);
    min-height: 32px;
}
.list-count-bar {
    display: flex;
    justify-content: flex-end;
    margin: 10px 2px 0;
    color: var(--text-secondary);
    font-size: var(--fs-13);
}
.fab {
    width: 44px; height: 44px;
    min-width: 44px; min-height: 44px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    box-shadow: var(--shadow-md);
    transition: transform 0.15s, background 0.15s;
}
.fab:hover { background: var(--primary-dark); transform: scale(1.05); }

/* ============================================================
   卡片列表（单行模式）
   ============================================================ */
.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.item-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 12px 16px;
    border: 1px solid var(--border-light);
    transition: box-shadow 0.2s, transform 0.15s;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
}
.item-card:hover { box-shadow: var(--shadow-md); }
.item-card.warning {
    border-color: rgba(239, 68, 68, 0.40);
    background: linear-gradient(180deg, #ffffff 0%, #fff8f7 100%);
}

/* 卡片主区：状态点 | 左缩略图 | 中名称/规格/安全库存 | 右库存大数字 */
.card-main {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

/* 左侧缩略图：点击放大查看 */
.card-img {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-gray);
    flex-shrink: 0;
    cursor: zoom-in;
    border: 1px solid var(--border-light);
}
.card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}
.card-img:hover img { transform: scale(1.06); }

/* 中间信息列 */
.card-info {
    flex: 1;
    min-width: 0;
}

/* 标题行 */
.card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--fs-15);
    font-weight: 600;
    min-width: 0;
    flex-shrink: 1;
}
/* 状态点：位于缩略图左侧，垂直居中 */
.card-main > .dot {
    width: 10px; height: 10px;
    border-radius: var(--radius-full);
    flex-shrink: 0;
}
.card-title .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 预警徽章 */
.warn-badge {
    background: rgba(239, 68, 68, 0.10);
    color: var(--danger);
    font-size: var(--fs-11);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* 分类徽章 */
.cat-badge {
    background: var(--primary-light);
    color: var(--primary);
    font-size: var(--fs-11);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}
/* 单价徽章 */
.price-badge {
    background: rgba(255, 77, 79, 0.1);
    color: #ff4d4f;
    font-size: var(--fs-11);
    padding: 2px 7px;
    border-radius: var(--radius-full);
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

/* 右侧大数字区 */
.card-stock {
    text-align: right;
    flex-shrink: 0;
    line-height: 1;
}
.stock-num {
    font-size: var(--fs-32);
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}
.stock-unit {
    font-size: var(--fs-13);
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 2px;
}
.stock-label {
    font-size: var(--fs-11);
    color: var(--text-muted);
    margin-top: 5px;
}
.item-card.warning .stock-num { color: var(--danger); }
.item-card.warning .stock-num .stock-unit { color: var(--danger); opacity: 0.7; }

/* 规格行 */
.card-spec {
    color: var(--text-secondary);
    font-size: var(--fs-13);
    line-height: 1.4;
    margin-top: 4px;
    margin-bottom: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 安全库存行（独立） */
.card-safe {
    color: var(--text-muted);
    font-size: var(--fs-13);
    line-height: 1.4;
    margin-bottom: 0;
}

/* 右侧操作按钮区 */
.card-actions {
    border-top: none;
    padding-top: 0;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 0;
    flex-shrink: 0;
}
.btn-act {
    min-height: 36px;
    min-width: 36px;
    padding: 0 10px;
    border-radius: var(--radius-md);
    font-size: var(--fs-13);
    color: var(--text-secondary);
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: background 0.15s, color 0.15s;
    flex: 0 1 auto;
}
.btn-act i { font-size: 14px; }
.btn-act:hover { background: var(--bg-gray); color: var(--text-primary); }
.btn-act.primary:hover { background: var(--primary-light); color: var(--primary); }
.btn-act.danger:hover { background: var(--danger-light); color: var(--danger); }

/* 触控目标 ≥44px（移动端） */
@media (max-width: 767px) {
    .btn-act { min-height: 44px; min-width: 44px; padding: 0 8px; }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    grid-column: 1 / -1;
}
.empty-state i { font-size: 48px; opacity: 0.5; margin-bottom: 12px; display: block; }
.empty-state p { margin: 0; font-size: var(--fs-13); }

/* ============================================================
   通用按钮 / 图标按钮
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    height: 44px;
    min-height: 44px;
    font-size: var(--fs-14);
    border-radius: var(--radius-md);
    transition: background 0.15s, color 0.15s, border 0.15s;
    white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-gray); color: var(--text-primary); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.icon-btn {
    width: 36px; height: 36px;
    min-width: 44px; min-height: 44px;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    display: flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: var(--bg-gray); color: var(--text-primary); }

/* ============================================================
   Modal（新增/编辑/入出库）
   ============================================================ */
.modal-mask {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}
.modal-mask.show { display: flex; }
.modal {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    width: min(440px, 92vw);
    max-height: 88vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modal-in 0.18s ease-out;
}
@keyframes modal-in {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to   { opacity: 1; transform: none; }
}
.modal-header {
    padding: 20px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
}
.modal-header h3 {
    margin: 0;
    flex: 1;
    text-align: center;
    font-size: var(--fs-18);
    font-weight: 600;
    color: var(--text-primary);
}
.modal-close {
    width: 36px; height: 36px;
    min-width: 36px; min-height: 36px;
    border-radius: var(--radius-full);
    color: var(--text-muted);
    position: absolute;
    right: 14px; top: 14px;
}
.modal-close:hover { background: var(--bg-gray); color: var(--text-primary); }

.modal-subtitle {
    text-align: center;
    font-size: var(--fs-13);
    color: var(--text-muted);
    padding: 6px 24px 20px;
    margin: 0;
}

.modal-body {
    padding: 0 24px 10px;
    overflow-y: auto;
    overflow-x: hidden;   /* 内容溢出时只允许纵向滚动，不出横向滚动条 */
}

.modal-footer {
    padding: 16px 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/* Modal 表单 */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 14px;
}
.form-grid .span-2 { grid-column: 1 / -1; }

/* ===== 多图上传控件（新增 / 编辑商品弹窗） ===== */
.img-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.img-thumb {
    width: 84px;
    height: 84px;
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    flex-shrink: 0;
    border: 1px solid var(--border-light);
}
.img-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}
.img-thumb-del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.img-thumb-del:hover { background: rgba(239, 68, 68, 0.85); }
.img-add {
    width: 84px;
    height: 84px;
    border-radius: var(--radius-md);
    border: 1px dashed var(--border);
    background: var(--bg-gray);
    color: var(--text-muted);
    font-size: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    flex-shrink: 0;
}
.img-add:hover { border-color: var(--primary); color: var(--primary); }
.img-add i { font-size: 18px; }

/* ===== Lightbox 图片查看器 ===== */
.lightbox-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}
.lightbox-mask.show { display: flex; }
.lightbox-box {
    position: relative;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
    user-select: none;
    -webkit-user-drag: none;
}
.lightbox-close {
    position: absolute;
    top: -48px;
    right: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-close:hover { background: rgba(255, 255, 255, 0.3); }
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.lightbox-nav:hover { background: rgba(255, 255, 255, 0.3); }
.lightbox-prev { left: -60px; }
.lightbox-next { right: -60px; }
.lightbox-counter {
    position: absolute;
    bottom: -36px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

/* 移动端 Lightbox 按钮内移 */
@media (max-width: 768px) {
    .lightbox-prev { left: 8px; }
    .lightbox-next { right: 8px; }
    .lightbox-close { top: 8px; right: 8px; }
}
.form-item label {
    display: block;
    font-size: var(--fs-13);
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}
.form-item label .req { color: var(--danger); }
.form-item input[type="text"],
.form-item input[type="number"],
.form-item textarea {
    width: 100%;
    height: 44px;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 12px;
    font-size: var(--fs-14);
    color: var(--text-primary);
    background: #fff;
}
.form-item input:focus,
.form-item textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}
.form-item input::placeholder { color: #c7c7cc; }

/* 表单下拉选择器（新增/编辑弹窗里的所属分类） */
.form-item .form-select {
    width: 100%;
    height: 44px;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 12px;
    font-size: var(--fs-14);
    color: var(--text-primary);
    background: #fff;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%239ca3af' d='M6 8L1 3h10z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}
.form-item .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22, 119, 255, 0.1);
}

/* 筛选栏分类下拉 */
.filter-wrap .filter-select {
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 28px 0 12px;
    font-size: var(--fs-13);
    color: var(--text-primary);
    background: #fff;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path fill='%239ca3af' d='M6 8L1 3h10z'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
}
.filter-wrap .filter-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* 入出库数量选择 */
.qty-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 16px 0 8px;
}
.qty-row .qty-btn {
    width: 52px; height: 52px;
    min-width: 44px; min-height: 44px;
    border-radius: var(--radius-md);
    background: var(--bg-gray);
    font-size: 24px;
    color: var(--text-primary);
    display: flex; align-items: center; justify-content: center;
}
.qty-row .qty-btn:hover { background: #e5e7eb; }
.qty-row input {
    flex: 1;
    min-width: 0;           /* 允许 flex 收缩，防止 number input 撑破弹窗出现横向滚动条 */
    text-align: center;
    height: 52px;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--fs-24);
    font-weight: 600;
    background: #fff;
    -moz-appearance: textfield;           /* 隐藏 Firefox spinner */
    appearance: textfield;
}
.qty-row input::-webkit-outer-spin-button,
.qty-row input::-webkit-inner-spin-button {
    -webkit-appearance: none;             /* 隐藏 WebKit 上下小箭头 */
    margin: 0;
}
.qty-hint { font-size: var(--fs-12); color: var(--text-muted); }

/* ============================================================
   Toast & Loading
   ============================================================ */
.toast-wrap {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    pointer-events: none;
}
.toast {
    background: rgba(17, 24, 39, 0.92);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius-full);
    font-size: var(--fs-13);
    box-shadow: var(--shadow-lg);
    animation: toast-in 0.2s ease-out;
    pointer-events: auto;
    max-width: 85vw;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toast-in {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: none; }
}

.loading-mask {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 1500;
    display: flex; align-items: center; justify-content: center;
}
.loading-spinner { font-size: 36px; color: var(--primary); }

/* ============================================================
   历史查询页
   ============================================================ */
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 16px;
}
.page-head-left { flex: 1; min-width: 0; }
.page-head-right { flex-shrink: 0; }
.page-title {
    margin: 0 0 4px;
    font-size: var(--fs-18);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-title i { color: var(--primary); font-size: 22px; }
.page-desc { margin: 0; font-size: var(--fs-13); color: var(--text-muted); }
.count-badge {
    background: var(--bg-gray);
    color: var(--text-secondary);
    font-size: var(--fs-12);
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-weight: 500;
    white-space: nowrap;
}

.filter-panel {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 14px 18px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 14px;
}
.filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.filter-row:last-child { margin-bottom: 0; }
.filter-date .date-input { flex: 1; position: relative; }
.filter-date .date-input i {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}
.filter-date .date-input input {
    width: 100%;
    height: 44px;
    min-height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 12px 0 40px;
    font-size: var(--fs-14);
    background: var(--bg-gray);
}
.filter-date .date-sep { color: var(--text-muted); }
.filter-actions { justify-content: space-between; }

/* PC 历史表格 */
.history-table-wrap {
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 20px;
}
.history-table { width: 100%; border-collapse: collapse; font-size: var(--fs-13); }
.history-table thead th {
    text-align: left;
    padding: 14px 18px;
    background: var(--bg-gray);
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    font-size: var(--fs-13);
    white-space: nowrap;
}
.history-table tbody td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}

/* 时间列：两行 */
.col-time .t-date { font-size: var(--fs-13); font-weight: 500; color: var(--text-primary); line-height: 1.3; }
.col-time .t-time { font-size: var(--fs-11); color: var(--text-muted); line-height: 1.3; margin-top: 2px; }

.history-table tbody tr:last-child td { border-bottom: none; }
.history-table tbody tr:hover td { background: #fafbfc; }

/* 变动类型徽章 */
.type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: var(--fs-11);
    font-weight: 500;
    white-space: nowrap;
}
.type-in     { background: var(--success-light);   color: var(--success); }
.type-out    { background: var(--danger-light);    color: var(--danger); }
.type-delete { background: var(--warning-light);   color: var(--warning); }
.type-create { background: #dbeafe; color: #2563eb; }
.type-edit   { background: #ede9fe; color: #7c3aed; }

.qty-plus  { color: var(--success); font-weight: 500; }
.qty-minus { color: var(--danger);   font-weight: 500; }
.qty-none  { color: var(--text-muted); }

/* 备注列：限宽截断，悬浮 title 看全文（编辑类备注较长） */
.col-remark { max-width: 200px; }
.col-remark .remark-text {
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    color: var(--text-secondary);
}

/* 移动端历史卡片 */
.history-cards { display: none; }
@media (max-width: 767px) {
    .history-table { display: none; }
    .history-cards { display: flex; flex-direction: column; gap: 10px; padding: 4px; }
    .history-card {
        background: var(--bg-white);
        border-radius: var(--radius-lg);
        padding: 14px 16px;
        box-shadow: var(--shadow-sm);
    }
    .hc-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 8px; }
    .hc-item-name { font-weight: 600; font-size: var(--fs-14); }
    .hc-time { font-size: var(--fs-12); color: var(--text-muted); margin-bottom: 8px; }
    .hc-mid { display: flex; justify-content: space-between; font-size: var(--fs-13); margin-bottom: 6px; color: var(--text-secondary); }
    .hc-remark { font-size: var(--fs-12); color: var(--text-secondary); margin-bottom: 6px; word-break: break-all; }
    .hc-bottom { display: flex; justify-content: space-between; font-size: var(--fs-12); color: var(--text-muted); }
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 14px 4px 4px;
    gap: 16px;
}
.page-meta {
    color: var(--text-muted);
    font-size: var(--fs-13);
    flex-shrink: 0;
}
.page-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.page-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: var(--bg-white);
    color: var(--text-secondary);
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}
.page-btn:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}
.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.page-nums {
    display: flex;
    align-items: center;
    gap: 4px;
}
.page-num {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
    background: var(--bg-white);
    color: var(--text-secondary);
    font-size: var(--fs-13);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}
.page-num:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.page-num.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    font-weight: 600;
}
.page-dots {
    padding: 0 6px;
    color: var(--text-muted);
    font-size: var(--fs-13);
    line-height: 32px;
}

/* 移动端分页简化 */
@media (max-width: 767px) {
    .pagination { flex-direction: column; gap: 10px; align-items: stretch; }
    .page-meta { text-align: center; }
    .page-controls { justify-content: center; flex-wrap: wrap; }
}

/* ============================================================
   登录页
   ============================================================ */
.login-page {
    background: linear-gradient(135deg, #e7f0ff 0%, #f0f7ff 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-wrap { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.login-card {
    width: 100%;
    background: var(--bg-white);
    border-radius: var(--radius-xl);
    padding: 34px 28px;
    box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.brand-logo {
    width: 64px; height: 64px;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px;
    margin: 0 auto 14px;
    box-shadow: 0 4px 12px rgba(22, 119, 255, 0.3);
}
.brand-title { margin: 0; font-size: var(--fs-18); font-weight: 600; }
.brand-subtitle { margin: 4px 0 0; font-size: var(--fs-13); color: var(--text-muted); }

.login-form .form-item { margin-bottom: 16px; }
.login-form label { display: block; font-size: var(--fs-13); color: var(--text-secondary); margin-bottom: 6px; }
.login-form .input-wrap { position: relative;}
.login-form .input-wrap i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted);}
.login-form .input-wrap input { padding-left: 40px; }
.login-form input {
    width: 100%;
    height: 48px; min-height: 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0 14px 0 42px;
    font-size: var(--fs-14);
    background: var(--bg-gray);
}
.login-form input:focus { outline: none; border-color: var(--primary); background: #fff; }

/* 分隔线 */
.login-divider {
    display: flex; align-items: center; justify-content: center;
    margin: 22px 0 16px; gap: 12px;
    color: var(--text-muted); font-size: var(--fs-12);
}
.login-divider::before, .login-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}

/* 钉钉扫码登录按钮 */
.btn-dingtalk {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    width: 100%; height: 48px; min-height: 44px;
    border-radius: var(--radius-md);
    background: #1677ff; color: #fff;
    font-size: var(--fs-15); font-weight: 500;
    text-decoration: none;
    transition: all .2s ease;
    border: 1px solid #1677ff;
}
.btn-dingtalk:hover { background: #0f66e0; border-color: #0f66e0; color: #fff; }
.btn-dingtalk:active { transform: scale(.99); }
.btn-dingtalk .dingtalk-icon { width: 22px; height: 22px; flex-shrink: 0; }

/* 钉钉二维码弹窗 */
.dingtalk-modal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; }
.dingtalk-modal-mask { position: absolute; inset: 0; background: rgba(0,0,0,.45); }
.dingtalk-modal-box { position: relative; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 8px 32px rgba(0,0,0,.2); }
.dingtalk-modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #f0f0f0; font-size: 15px; font-weight: 600; color: #333; }
.dingtalk-modal-close { border: none; background: none; font-size: 22px; line-height: 1; color: #999; cursor: pointer; padding: 0; transition: color .2s; }
.dingtalk-modal-close:hover { color: #333; }
.dingtalk-modal-body { padding: 20px; display: flex; align-items: center; justify-content: center; min-height: 320px; }
.dingtalk-modal-body iframe { border: none; border-radius: 8px; }

/* ============================================================
   移动端 H5（≤767px）
   ============================================================ */
@media (max-width: 767px) {
    body { flex-direction: column; }

    /* sidebar → 底部 Tab Bar */
    .sidebar {
        flex-direction: row;
        width: 100%;
        height: var(--tabbar-h);
        border-right: none;
        border-top: 1px solid var(--border-light);
        order: 2;
        padding: 0;
    }
    .sidebar-logo, .sidebar-user { display: none; }

    /* 顶部用户条（右上角用户名 + 退出） */
    .mobile-userbar { display: flex; }
    .sidebar-nav {
        flex-direction: row;
        width: 100%;
        padding: 4px;
        gap: 0;
    }
    .sidebar-nav .nav-item {
        flex: 1;
        flex-direction: column;
        gap: 2px;
        padding: 6px 4px;
        font-size: var(--fs-11);
        min-height: 52px;
        border-radius: var(--radius-sm);
    }
    .sidebar-nav .nav-item i { font-size: 15px; width: auto; }
    .sidebar-nav .nav-item.active::before { display: none; }
    .sidebar-nav .nav-item.active {
        background: transparent;
        color: var(--primary);
        box-shadow: none;
        font-weight: 500;
    }

    /* main-content 撑满 */
    .main-content {
        order: 1;
        padding: 14px 14px 20px;
        flex: 1;
    }
    .main-content > .board,
    .main-content > .content-panel,
    .main-content > .page-head,
    .main-content > .filter-panel,
    .main-content > .history-table-wrap {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    /* 看板 2×2 stat 卡片 */
    .board { padding: 18px; border-radius: var(--radius-xl); margin-bottom: 14px; }
    .board-cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-value { font-size: var(--fs-20); }

    /* 白色面板 */
    .content-panel { padding: 12px 12px 16px; border-radius: var(--radius-lg); margin-bottom: 14px; }
    .toolbar { flex-wrap: wrap; }

    /* 卡片单列，按钮只留图标 */
    .card-grid { grid-template-columns: 1fr; gap: 12px; }
    .item-card { padding: 14px 16px; }
    .card-main { gap: 10px; }
    .card-img { width: 64px; height: 64px; }
    .stock-num { font-size: var(--fs-28); }
    .btn-act span.txt { display: none; }
    .btn-act i { font-size: 16px; }
    .btn-act { min-height: 44px; }

    /* Modal 全宽大按钮 */
    .modal { width: min(400px, 94vw); }
    .form-grid { grid-template-columns: 1fr; gap: 14px; }
    .form-grid .span-2 { grid-column: 1; }
    .modal-footer { flex-direction: column-reverse; gap: 12px; }
    .modal-footer .btn-primary { width: 100%; height: 48px; background: var(--text-primary); border-radius: var(--radius-md); font-size: var(--fs-15); }
    .modal-footer .btn-primary:hover { background: #000; }
    .modal-footer .btn-ghost { width: 100%; height: 44px; background: #fff; border: 1px solid var(--border); color: var(--text-secondary); }

    /* 确认弹窗（退出登录等）：确定/取消并排，各占一半 */
    .modal-confirm .modal-footer { flex-direction: row; gap: 12px; }
    .modal-confirm .modal-footer .btn { width: auto; flex: 1; min-height: 44px; }

    /* 历史页 filter */
    .filter-row { flex-wrap: wrap; }
}

/* 超小屏 ≤ 380px */
@media (max-width: 379px) {
    .card-title { font-size: var(--fs-14); }
    .card-img { width: 56px; height: 56px; }
    .stock-num { font-size: var(--fs-24); }
    .board-cards .stat-value { font-size: var(--fs-18); }
}

/* ============================================================
   出入库统计汇总（看板）
   ============================================================ */

/* ---- 整体三栏布局 ---- */
.dashboard-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.dash-main {
    flex: 1;
    min-width: 0;   /* 防止 flex 子元素撑爆 */
}
.dash-main > * {
    margin-bottom: 24px;
}
.dash-side {
    width: 380px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
}
.dash-side::-webkit-scrollbar { width: 6px; }
.dash-side::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 3px; }

.stats-section {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    position: relative;
}
.stats-section-head {
    margin-bottom: 12px;
}
.stats-section-head h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.stats-section-head h3 i { color: var(--primary); }

.stats-ctrl {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
}
.stats-year-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    font-size: 12px;
    transition: all .15s;
}
.stats-year-btn:hover { border-color: var(--primary); color: var(--primary); }
.stats-year {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    min-width: 56px;
    text-align: center;
}
.stats-level {
    display: inline-flex;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
    margin-left: 6px;
}
.stats-level button {
    border: none;
    background: #fff;
    padding: 4px 12px;
    font-size: 13px;
    color: #6b7280;
    cursor: pointer;
    transition: all .15s;
}
.stats-level button:hover { color: var(--primary); }
.stats-level button.active {
    background: var(--primary);
    color: #fff;
}

/* 格子网格（通用） */
.stats-grid {
    margin-bottom: 16px;
}
.stats-grid.month .stats-month-grid,
.stats-grid.year  .stats-year-grid,
.stats-grid.week  .stats-week-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stats-cell {
    background: #fafafa;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    padding: 14px 10px;
    text-align: center;
    transition: all .15s;
    display: flex;
    flex-direction: column;
    gap: 8px;
    cursor: default;
}
.stats-cell:hover { border-color: var(--primary); background: #f5f9ff; }
.stats-cell.has-data { background: #fff; border-color: #e8e8e8; }
.stats-cell.current {
    border-color: var(--primary);
    border-width: 2px;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1);
}
.stats-cell-label {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}
.stats-cell-val {
    font-size: 16px;
    color: #6b7280;
    font-weight: 600;
}
.stats-cell-val .in  { color: #52c41a; }
.stats-cell-val .out { color: #ff4d4f; }

/* ---- 日视图：月历 ---- */
.stats-grid.day {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.stats-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
}
.stats-weekdays span {
    font-size: 13px;
    color: #9ca3af;
    padding: 6px 0;
    font-weight: 500;
}
.stats-day-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}
.stats-day-cell {
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 10px 6px;
    text-align: center;
    min-height: 68px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transition: all .15s;
}
.stats-day-cell:hover { border-color: var(--primary); }
.stats-day-cell.other { background: #fafafa; color: #d1d5db; }
.stats-day-cell.other .day-num { color: #d1d5db; }
.stats-day-cell.has-data { background: #fff; border-color: #f0f0f0; }
.stats-day-cell.today {
    border-color: #e5e7eb;
    border-width: 1px;
    background: #f5f5f5;
}
.stats-day-cell.today .day-num { color: #374151; font-weight: 600; }
.day-num {
    font-size: 15px;
    color: #1f2937;
    font-weight: 500;
}
.day-val {
    font-size: 10px;
    line-height: 1.4;
}
.day-val .in  { color: #9ca3af; display: block; }
.day-val .out { color: #9ca3af; display: block; }

/* ---- 周视图 ---- */
.stats-week-cell {
    background: #fafafa;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    padding: 16px 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all .15s;
}
.stats-week-cell:hover { border-color: var(--primary); background: #f5f9ff; }
.stats-week-cell.has-data { background: #fff; border-color: #e8e8e8; }
.stats-week-range {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}
.stats-week-val {
    font-size: 18px;
    color: #6b7280;
    font-weight: 600;
}
.stats-week-val .in  { color: #52c41a; }
.stats-week-val .out { color: #ff4d4f; }

.stats-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px 0;
    color: #9ca3af;
    font-size: 13px;
}

/* 汇总行 */
.stats-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #fafbfc;
    border-radius: 10px;
    border: 1px solid #f0f0f0;
}
.stats-summary-total {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 14px;
    color: #6b7280;
}
.stats-summary-val {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
}
.stats-summary-unit {
    font-size: 13px;
    color: #9ca3af;
}
.stats-summary-break {
    display: flex;
    gap: 24px;
}
.stats-summary-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #374151;
}
.stats-summary-label { color: #6b7280; }
.stats-summary-num { font-weight: 600; color: #1f2937; min-width: 36px; text-align: right; }
.stats-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}
.stats-dot.in  { background: #52c41a; }
.stats-dot.out { background: #ff4d4f; }

/* ---- 日期格子可点击 + 选中态 ---- */
.stats-cell,
.stats-day-cell,
.stats-week-cell { cursor: pointer; }
.stats-cell.selected,
.stats-week-cell.selected,
.stats-day-cell.selected {
    border-color: var(--primary);
    background: #f5f9ff;
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.12);
}
.stats-day-cell.other.selected { color: #6b7280; }
.stats-day-cell.other.selected .day-num { color: #374151; }

/* ---- 出入库明细（右下角）---- */
.stats-detail {
    margin-top: 14px;
    border: 1px solid #f0f0f0;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
}
.stats-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    background: #fafbfc;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    user-select: none;
}
.stats-detail-title {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stats-detail-range {
    min-width: 0;
    font-size: 12px;
    color: #9ca3af;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.stats-detail-toggle {
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #9ca3af;
    cursor: pointer;
    transition: color .15s ease, background .15s ease;
}
.stats-detail-toggle:hover { color: var(--primary); background: #f5f9ff; }
.stats-detail-toggle svg { transition: transform .18s ease; }
.stats-detail.collapsed .stats-detail-toggle svg { transform: rotate(180deg); }
.stats-detail.collapsed .stats-detail-body { display: none; }
.stats-detail.collapsed .stats-detail-head { border-bottom: none; }
.stats-detail-body {
    max-height: 320px;
    overflow-y: auto;
    padding: 8px 10px;
}
.stats-detail-body::-webkit-scrollbar { width: 6px; }
.stats-detail-body::-webkit-scrollbar-thumb { background: #e5e7eb; border-radius: 3px; }
.stats-detail-empty {
    padding: 18px 0;
    text-align: center;
    font-size: 12px;
    color: #9ca3af;
}

.detail-group + .detail-group { margin-top: 10px; }
.detail-group-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 2px 6px;
}
.detail-group-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
}
.detail-group-sum { font-size: 12px; color: #9ca3af; }
.detail-item {
    padding: 8px 10px;
    border: 1px solid #f2f3f5;
    border-radius: 8px;
    background: #fff;
}
.detail-item + .detail-item { margin-top: 6px; }
.detail-item-top {
    display: flex;
    align-items: center;
    gap: 8px;
}
.detail-item-name {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.detail-item-qty { font-size: 13px; font-weight: 700; }
.detail-item-qty.in  { color: #52c41a; }
.detail-item-qty.out { color: #ff4d4f; }
.detail-item-sub {
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    color: #9ca3af;
}
.detail-item-flow { color: #6b7280; }
.detail-item-remark {
    margin-top: 3px;
    font-size: 12px;
    color: #9ca3af;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 移动端 */
@media (max-width: 768px) {
    .dashboard-layout { flex-direction: column; gap: 16px; }
    .dash-side { width: 100%; position: static; max-height: none; overflow: visible; }
    .stats-section { padding: 16px; }
    .stats-grid.month .stats-month-grid,
    .stats-grid.year  .stats-year-grid,
    .stats-grid.week  .stats-week-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .stats-day-grid { grid-template-columns: repeat(7, 1fr); gap: 4px; }
    .stats-day-cell { min-height: 56px; padding: 6px 2px; }
    .stats-summary { flex-direction: column; gap: 10px; align-items: flex-start; }
    .stats-detail-body { max-height: none; }
    .stats-level button { padding: 4px 8px; font-size: 12px; }
    .stats-year-btn { width: 24px; height: 24px; }
}

/* ============================================================
   版本更新页
   ============================================================ */
.changelog-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-bottom: 8px;
}
.changelog-item {
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}
.changelog-item.latest {
    border-color: rgba(22, 119, 255, 0.35);
    box-shadow: 0 4px 16px rgba(22, 119, 255, 0.10);
}
.changelog-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}
.changelog-version {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
}
.changelog-latest {
    flex: none;
    padding: 2px 9px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: #fff;
    font-size: 11px;
    font-weight: 500;
}
.changelog-date {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}
.changelog-group {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0 2px;
}
.changelog-group + .changelog-group {
    margin-top: 6px;
    border-top: 1px dashed var(--border-light);
}
.changelog-tag {
    flex: none;
    height: 22px;
    line-height: 22px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
}
.changelog-tag.tag-new { background: var(--success-light); color: var(--success); }
.changelog-tag.tag-fix { background: var(--primary-light); color: var(--primary-dark); }
.changelog-tag.tag-change { background: var(--warning-light); color: #b45309; }
.changelog-tag.tag-other { background: var(--bg-gray); color: var(--text-secondary); }
.changelog-items {
    flex: 1;
    min-width: 0;
    margin: 0;
    padding-left: 18px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.changelog-items li {
    font-size: var(--fs-13);
    line-height: 1.7;
    color: var(--text-secondary);
}

@media (max-width: 768px) {
    .changelog-item { padding: 14px 16px; border-radius: var(--radius-lg); }
    .changelog-head { flex-wrap: wrap; gap: 8px; }
    .changelog-date { margin-left: 0; width: 100%; }
    .changelog-group { flex-direction: column; gap: 8px; }
    .changelog-items { padding-left: 16px; }
}
