/* ═══════════════════════════════════════
   UxBAN城市数码-运营后台 — 全局样式（浅色现代版）
   ═══════════════════════════════════════ */

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef2ff;
    --primary-color: var(--primary);
    --pri: var(--primary);
    --pri-hover: var(--primary-hover);
    --bg: #f6f7fb;
    --card-bg: #ffffff;
    --sidebar-bg: #ffffff;
    --text: #1e2534;
    --text-color: var(--text);
    --text-muted: #667085;
    --muted: var(--text-muted);
    --border: #e7e9f0;
    --border-color: var(--border);
    --danger: #e5484d;
    --bad: var(--danger);
    --success: #12a150;
    --ok: var(--success);
    --warning: #e8930c;
    --info: #2563eb;
    --accent: var(--info);
    --radius: 14px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 8px 24px -12px rgba(16, 24, 40, .14);
    --shadow-lg: 0 4px 8px rgba(16, 24, 40, .06), 0 24px 48px -16px rgba(16, 24, 40, .22);
    --grad-primary: linear-gradient(135deg, #6366f1, #4f46e5);
    --grad-soft: linear-gradient(180deg, #ffffff, #fafbff);
    /* 表面色（用于替代硬编码的 #fff / #fafbfd / #f3f4f9 等） */
    --surface-1: #ffffff;   /* 卡片/输入框 */
    --surface-2: #fafbfd;   /* 页脚/表头浅底 */
    --surface-3: #f3f4f9;   /* hover/次级底 */
    --hover-bg: #f3f4f9;
    --heading: #111827;     /* 标题色 */
    --input-bg: #ffffff;
}

/* ── 暗黑模式 ── */
[data-theme="dark"] {
    --primary: #7c86ff;
    --primary-hover: #95a0ff;
    --primary-soft: rgba(124, 134, 255, .16);
    --bg: #0f1117;
    --card-bg: #171a21;
    --sidebar-bg: #13151b;
    --text: #e6e8ee;
    --text-muted: #9aa3b2;
    --border: #2a2f3a;
    --danger: #f06a6f;
    --success: #3ecf7a;
    --warning: #f0b75a;
    --info: #6ea8ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -12px rgba(0, 0, 0, .6);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, .5), 0 24px 48px -16px rgba(0, 0, 0, .7);
    --grad-primary: linear-gradient(135deg, #7c86ff, #5b66e8);
    --grad-soft: linear-gradient(180deg, #1a1e26, #171a21);
    --surface-1: #171a21;
    --surface-2: #1c2028;
    --surface-3: #232834;
    --hover-bg: #232834;
    --heading: #f0f2f7;
    --input-bg: #1c2028;
    color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* ── 布局 ── */
.app { display: flex; min-height: 100vh; }

/* ── 侧边栏（浅色） ── */
.sidebar {
    width: 232px;
    background: var(--sidebar-bg);
    color: #5b6472;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 18px 16px 16px; font-size: 14px; font-weight: 700;
    line-height: 1.3;
    color: var(--heading); border-bottom: 1px solid var(--border); margin-bottom: 8px;
    flex-shrink: 0;
}
.sidebar-brand svg {
    box-sizing: content-box;
    width: 18px; height: 18px; padding: 6px; flex-shrink: 0;
    color: #fff; background: var(--grad-primary);
    border-radius: 9px; box-shadow: 0 4px 10px -4px rgba(79, 70, 229, .5);
}
.sidebar-brand span { min-width: 0; }
.sidebar-nav {
    display: flex; flex-direction: column;
    gap: 2px; padding: 6px 10px 20px;
    flex: 1; overflow-y: auto;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #d6dae3; border-radius: 3px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }

/* 菜单分组 */
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group + .nav-group { margin-top: 14px; }
.nav-group-title {
    padding: 8px 12px 6px;
    font-size: 11px; font-weight: 600;
    letter-spacing: .1em;
    color: #9aa1af; user-select: none;
}
.nav-group:first-child .nav-group-title { padding-top: 4px; }
.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: 10px;
    color: #5b6472; text-decoration: none; font-weight: 500;
    font-size: 13.5px;
    transition: all .15s;
}
.nav-item:hover { background: #f1f3f9; color: #1e2534; }
.nav-item.active {
    background: var(--primary-soft); color: var(--primary);
    font-weight: 600;
}
.nav-item.active svg { stroke: var(--primary); }
.nav-item svg { flex-shrink: 0; }
/* 菜单右侧计数徽章（运营行动待办数） */
.nav-badge {
    min-width: 18px; height: 18px; padding: 0 5px;
    background: #ef4444; color: #fff; border-radius: 9px;
    font-size: 11px; font-weight: 600; line-height: 18px; text-align: center;
}

/* ── 主区域 ── */
.main { flex: 1; padding: 28px 36px 40px; overflow-x: hidden; max-width: 1440px; }

/* ── 页头 ── */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 22px; flex-wrap: wrap; gap: 14px;
}
.page-header h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }

/* ── 卡片 ── */
.card {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 22px; margin-bottom: 20px;
    box-shadow: var(--shadow); border: 1px solid var(--border);
}
.card h2 { font-size: 15px; font-weight: 600; margin-bottom: 14px; color: var(--heading); }

/* ── 统计网格 ── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.stat-card {
    background: var(--card-bg); border-radius: var(--radius);
    padding: 20px 22px; box-shadow: var(--shadow); border: 1px solid var(--border);
    transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.highlight-red .stat-value { color: var(--danger); }
.highlight-green .stat-value { color: var(--success); }
.highlight-blue .stat-value { color: var(--info); }

/* ── 表格 ── */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%; border-collapse: collapse; font-size: 13px;
    background: var(--card-bg); border-radius: var(--radius);
    overflow: hidden; box-shadow: var(--shadow);
}
.table th {
    background: #f7f8fc; padding: 11px 14px; text-align: left;
    font-weight: 600; color: #5b6472; white-space: nowrap;
    border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.table td {
    padding: 10px 14px; border-bottom: 1px solid #f0f1f6;
    white-space: nowrap; max-width: 250px; overflow: hidden; text-overflow: ellipsis;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f8f9fe; }
.table .empty { text-align: center; color: var(--text-muted); padding: 36px; }

.name-cell { max-width: 200px; }
.sku-link { color: var(--primary); cursor: pointer; text-decoration: underline dotted; }
.zero-stock { color: var(--danger); font-weight: 600; }

/* ── 按钮 ── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--card-bg);
    font-size: 13px; font-weight: 500; cursor: pointer;
    transition: all .15s; color: var(--text); white-space: nowrap;
}
.btn:hover { background: var(--hover-bg); border-color: var(--border); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
    background: var(--grad-primary); color: #fff;
    border: none; box-shadow: 0 4px 12px -4px rgba(79, 70, 229, .55);
}
.btn-primary:hover { background: linear-gradient(135deg, #4f46e5, #4338ca); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #d13b40; border-color: #d13b40; }
.btn-sm { padding: 5px 11px; font-size: 12px; border-radius: 8px; }
.btn-xs { padding: 2px 8px; font-size: 11px; border-radius: 6px; }

/* 行内编辑数字输入框 */
.inline-num {
    width: 72px; padding: 4px 6px; text-align: right;
    border: 1px solid var(--border); border-radius: 6px;
    font-size: 13px; background: var(--input-bg); color: var(--text);
}
.inline-num:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }

/* 列头可排序 */
.th-sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.th-sortable:hover { color: var(--primary); }

/* 规格选择卡片（切换/添加规格弹窗） */
.variant-card {
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
    background: var(--surface-1); cursor: pointer; transition: all .15s;
}
.variant-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(79,70,229,.10); }
.variant-card-spec { font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.3; }
.variant-card-meta {
    display: flex; gap: 6px; align-items: center; margin-top: 4px;
    font-size: 11px; color: var(--text-muted); flex-wrap: wrap;
}
.variant-card-meta .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.variant-card-foot {
    display: flex; align-items: center; justify-content: space-between; margin-top: 8px;
}
.variant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.variant-card-head { display: flex; align-items: flex-start; gap: 6px; }
.variant-card-head input[type="checkbox"] { margin-top: 2px; width: 14px; height: 14px; cursor: pointer; }
.variant-card.selected { border-color: var(--primary); background: #eef2ff; box-shadow: 0 0 0 2px rgba(79,70,229,.12) inset; }
.variant-card.disabled { opacity: .5; cursor: not-allowed; background: var(--surface-2); }
.variant-card.disabled:hover { border-color: var(--border); box-shadow: none; }
.variant-exists-tag {
    font-size: 11px; color: var(--text-muted); border: 1px solid var(--border);
    border-radius: 6px; padding: 1px 6px; white-space: nowrap;
}

/* 补货单汇总（大号展示，重要信息） */
.batch-summary-big {
    display: flex; gap: 24px; width: 100%; margin-top: 10px; padding-top: 10px;
    border-top: 1px dashed var(--border); flex-wrap: wrap;
}
.batch-summary-big .bs-item {
    font-size: 13px; color: var(--text-muted); display: inline-flex; align-items: baseline; gap: 8px;
}
.batch-summary-big .bs-item b {
    font-size: 22px; font-weight: 700; color: var(--text);
}
.batch-summary-big .bs-item:last-child b { color: var(--primary); }

/* ── 表单 ── */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.form-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
input[type="text"],
input[type="number"],
input[type="date"],
input[type="file"],
select,
textarea {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
    font-size: 14px; font-family: inherit; background: var(--input-bg);
    transition: border-color .15s, box-shadow .15s;
    color: var(--text);
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

/* ── 筛选栏 ── */
.filter-bar {
    display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap;
}

/* ── 区块 ── */
.section { margin-bottom: 24px; }
.section h2 { font-size: 16px; font-weight: 600; margin-bottom: 12px; }
.section-header {
    display: flex; justify-content: space-between;
    align-items: center; margin-bottom: 8px;
}

/* ── 标签/徽章（柔和浅底体系） ── */
.badge {
    display: inline-block; padding: 3px 11px;
    background: var(--primary-soft); color: var(--primary);
    border-radius: 999px; font-size: 12px; font-weight: 600;
}
/* 语义徽章（柔和浅底深字） */
.badge.green  { background: #e6f6ee; color: #0d8a4e; }
.badge.blue   { background: #e7edfe; color: #3352c8; }
.badge.violet { background: #f5f3ff; color: #7c3aed; }
.badge.amber  { background: #fdf1e0; color: #b26a06; }
.badge.red    { background: #fdecec; color: #c93a3f; }
.badge.slate  { background: #eef0f4; color: #667085; }
/* 库存等级徽章 */
.lvl-badge {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600;
}
.lvl-badge.danger { background: #fdecec; color: #c93a3f; }
.lvl-badge.warn { background: #fdf1e0; color: #b26a06; }
.lvl-badge.low { background: #fff3cd; color: #9a7200; }
.lvl-badge.ok { background: #e6f6ee; color: #0d8a4e; }
.lvl-badge.full { background: #e7edfe; color: #3352c8; }

/* ── 库存等级单元格 ── */
.lvl-cell { font-weight: 600; }
.lvl-cell.lvl-0 { color: var(--danger); }
.lvl-cell.lvl-1 { color: var(--warning); }
.lvl-cell.lvl-2 { color: var(--success); }

/* ── 状态标签 ── */
.status-tag {
    display: inline-block; padding: 3px 11px; border-radius: 999px;
    font-size: 12px; font-weight: 600;
}
.status-tag.pending { background: #fdf1e0; color: #b26a06; }
.status-tag.done { background: #e6f6ee; color: #0d8a4e; }
.status-tag.cancelled { background: #f1f2f6; color: #6b7280; }

/* ── 状态消息 ── */
.status-msg {
    margin: 10px 0; padding: 10px 14px; border-radius: 10px;
    font-size: 13px; display: flex; align-items: center; gap: 8px;
}
.status-msg.success { background: #e6f6ee; color: #0d8a4e; }
.status-msg.error { background: #fdecec; color: #c93a3f; }
.status-msg.warning { background: #fdf1e0; color: #b26a06; }
.status-msg.loading { background: #e7edfe; color: #3352c8; }

/* ── 空态 ── */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 56px 24px; text-align: center; color: var(--text-muted);
    background: var(--card-bg); border: 1px dashed var(--border);
    border-radius: var(--radius);
}
.empty-state svg { color: #c3c9d6; margin-bottom: 12px; }
.empty-state h2 { font-size: 16px; font-weight: 600; color: #4b5563; margin-bottom: 6px; }
.empty-state p { font-size: 13px; margin-bottom: 14px; }
.empty-state a { color: var(--primary); font-weight: 500; }

/* ── 分页 ── */
.pagination { margin-top: 16px; display: flex; justify-content: center; }
.paginator {
    display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center;
    padding: 10px 14px; background: var(--surface-1);
    border: 1px solid var(--border); border-radius: var(--radius);
}
.paginator .page-btn {
    min-width: 32px; height: 32px; padding: 0 8px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface-1); color: var(--text); cursor: pointer; font-size: 13px;
    transition: all .15s; display: inline-flex; align-items: center; justify-content: center;
}
.paginator .page-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(79,70,229,.06); }
.paginator .page-btn.active {
    background: var(--grad-primary); color: #fff; border-color: transparent;
    font-weight: 600;
}
.paginator .page-btn:disabled { opacity: .4; cursor: not-allowed; }
.paginator .page-info { color: var(--text-muted); font-size: 13px; }
.paginator .page-size-select {
    margin-left: 10px; padding: 5px 8px; font-size: 12.5px;
    border: 1px solid var(--border); border-radius: 8px;
    background: var(--input-bg); color: var(--text); cursor: pointer;
}
.paginator .page-size-select:focus { outline: none; border-color: var(--primary); }

/* ── 模态框 ── */
.modal { position: fixed; inset: 0; z-index: 1000; display: none; }
.modal-overlay {
    position: absolute; inset: 0;
    background: rgba(23, 26, 40, .45);
    backdrop-filter: blur(3px);
}
/* 独立弹窗（外层没有 .modal 容器时）：固定定位，跟随视口居中，无需滚到页面顶部 */
.modal-overlay.modal-fixed {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: flex-start; justify-content: center;
    overflow-y: auto; padding: 5vh 16px 24px;
}
.modal-overlay.modal-fixed > .modal-box { margin: 0 auto; }
.modal-content {
    position: relative; z-index: 1;
    margin: 6vh auto 0; width: min(560px, calc(100% - 32px));
    background: var(--card-bg); border-radius: 18px;
    box-shadow: var(--shadow-lg); overflow: hidden;
    max-height: 86vh; display: flex; flex-direction: column;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
    border: none; background: transparent; font-size: 20px;
    cursor: pointer; color: var(--text-muted); line-height: 1;
}
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-box {
    position: relative; z-index: 1;
    align-self: flex-start;
    margin: 8vh auto 0;
    width: calc(100% - 32px); max-width: 480px;
    background: var(--card-bg); border-radius: 18px;
    box-shadow: var(--shadow-lg); overflow-y: auto;
    max-height: 86vh; padding: 0 20px;
}
.modal-box > h3 {
    position: sticky; top: 0; z-index: 2;
    font-size: 15px; font-weight: 600;
    background: var(--card-bg);
    padding: 16px 20px 12px; margin: 0 -20px 14px;
    border-bottom: 1px solid var(--border);
    border-radius: 18px 18px 0 0;
}
.modal-box > .modal-actions { margin: 0 -20px; }
.modal-box .form-row { margin-bottom: 14px; }
.modal-box .form-row label { display: block; margin-bottom: 5px; font-size: 13px; color: var(--text-muted); }
.modal-box .form-row input,
.modal-box .form-row select {
    width: 100%;
}
.modal-actions {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 16px 22px; border-top: 1px solid var(--border);
    background: var(--surface-2);
}

/* ── Tab ── */
.tab-bar {
    display: flex; gap: 4px; border-bottom: 1px solid var(--border);
    margin-bottom: 18px;
}
.tab {
    padding: 9px 16px; font-size: 13.5px; font-weight: 500;
    color: var(--text-muted); cursor: pointer; border: none;
    background: none; border-bottom: 2px solid transparent;
    margin-bottom: -1px; transition: all .15s;
}
.tab:hover:not(.active) { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ── 补货/成本相关统计行 ── */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stats-row .stat-card { padding: 16px 20px; border-radius: var(--radius); }
.stats-row .stat-card .stat-label { font-size: 12px; }
.stats-row .stat-card .stat-value { font-size: 24px; }
.stats-row .stat-card.danger { border-left: 4px solid var(--danger); }
.stats-row .stat-card.danger .stat-value { color: var(--danger); }
.stats-row .stat-card.warn { border-left: 4px solid var(--warning); }
.stats-row .stat-card.warn .stat-value { color: var(--warning); }
.stats-row .stat-card.low { border-left: 4px solid #eab308; }
.stats-row .stat-card.low .stat-value { color: #ca8a04; }
.stats-row .stat-card.primary { border-left: 4px solid var(--primary); }
.stats-row .stat-card.primary .stat-value { color: var(--primary); }

/* ── 补货决策页 ── */
.repl-action-bar {
    display: flex; align-items: center; gap: 12px;
    flex-wrap: wrap; margin-bottom: 14px; padding: 10px 14px;
    background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
}
.repl-action-bar .btn { }
.repl-action-group { display: flex; align-items: center; gap: 8px; }
.repl-action-group .group-label {
    font-size: 12.5px; color: var(--text-muted); font-weight: 500;
}
.repl-action-group:first-child { margin-right: auto; }
.repl-action-divider {
    width: 1px; height: 22px; background: var(--border); margin: 0 2px;
}
/* 全选胶囊：复选框 + 文字 + 已选计数，更醒目 */
.repl-select-all {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    padding: 5px 10px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface-1); transition: all .15s; user-select: none;
}
.repl-select-all:hover { border-color: var(--primary); }
.repl-select-all input { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }
.repl-select-all .sel-count { color: var(--primary); font-weight: 600; }

.repl-filter-bar {
    display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px;
    padding: 12px 14px;
    background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
}
.repl-filter-bar input,
.repl-filter-bar select {
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
    font-size: 13.5px; background: var(--input-bg); color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.repl-filter-bar input:focus,
.repl-filter-bar select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.repl-filter-bar .filter-label {
    font-size: 12px; color: var(--text-muted); white-space: nowrap;
    display: inline-flex; align-items: center; gap: 4px;
}
.repl-filter-bar .filter-search {
    flex: 1; min-width: 180px; max-width: 320px;
}
.repl-filter-bar .btn { flex-shrink: 0; }

/* ── 补货单详情页统一工具栏（搜索+筛选+全选+批量操作+汇总） ── */
.repl-toolbar {
    margin-bottom: 12px; padding: 12px 14px;
    background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius);
}
.repl-toolbar-row {
    display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.repl-toolbar-row + .repl-toolbar-row {
    margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border);
}
.repl-toolbar-group {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.repl-toolbar .filter-search {
    flex: 1; min-width: 180px; max-width: 340px;
    padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px;
    font-size: 13.5px; background: var(--input-bg); color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}
.repl-toolbar .filter-search:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.repl-toolbar input[type="text"],
.repl-toolbar select {
    padding: 7px 11px; border: 1px solid var(--border); border-radius: 10px;
    font-size: 13.5px; background: var(--input-bg); color: var(--text);
}
.repl-toolbar select:focus { outline: none; border-color: var(--primary); }
.repl-toolbar .filter-label {
    font-size: 12px; color: var(--text-muted); white-space: nowrap;
    display: inline-flex; align-items: center; gap: 4px;
}
.repl-toolbar-summary {
    margin-left: auto; display: flex; align-items: center; gap: 16px;
}
.repl-toolbar-summary .sum-item {
    font-size: 13px; color: var(--text-muted); white-space: nowrap;
}
.repl-toolbar-summary .sum-item b {
    color: var(--text); font-size: 15px; font-weight: 700;
}

.repl-stat-row {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px; margin-bottom: 18px;
}
.repl-stat-card {
    padding: 14px 18px; background: var(--surface-1); border: 1px solid var(--border);
    border-radius: var(--radius); cursor: pointer; transition: all .15s;
    box-shadow: 0 1px 2px rgba(16,24,40,.03);
}
.repl-stat-card:hover { border-color: #c7cbe0; transform: translateY(-1px); }
.repl-stat-card.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.repl-stat-card .rsc-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.repl-stat-card .rsc-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.repl-stat-card.danger .rsc-value { color: var(--danger); }
.repl-stat-card.warning .rsc-value { color: var(--warning); }
.repl-stat-card.success .rsc-value { color: var(--success); }
.repl-stat-card.neutral .rsc-value { color: var(--text); }
.repl-stat-card.active .rsc-filter-hint { color: var(--primary); }
.repl-stat-card .rsc-filter-hint { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ── Markdown 渲染内容 ── */
.md-body { line-height: 1.8; }
.md-body ul, .md-body ol { margin: 6px 0; padding-left: 22px; }
.md-body li { margin: 2px 0; }
.md-body p { margin: 6px 0; }
.md-body table { border-collapse: collapse; margin: 8px 0; }
.md-body table th, .md-body table td { border: 1px solid var(--border); padding: 5px 10px; }
.md-body table th { background: var(--surface-3); font-weight: 600; }
.md-body code { background: var(--surface-3); padding: 0 4px; border-radius: 4px; font-size: 12px; }
.md-body pre { background: var(--surface-3); padding: 10px; border-radius: 8px; overflow: auto; }
.md-body a { color: var(--primary); }
.md-body strong { font-weight: 600; }

/* ── 补货建议商品名称/规格单元格 ── */
.pname-cell {
    max-width: 260px; word-break: break-all; line-height: 1.4;
    font-size: 13px;
}
.pspec-cell {
    max-width: 140px; word-break: break-all; line-height: 1.4;
    font-size: 12px; color: var(--text-muted);
}

/* ── 仓库类型标签 ── */
.wh-type-tag {
    display: inline-block; padding: 1px 8px; border-radius: 6px;
    font-size: 11px; font-weight: 500; white-space: nowrap;
}
.wh-type-tag.self { background: rgba(124,134,255,.16); color: #6366f1; }
.wh-type-tag.joint { background: rgba(62,207,122,.16); color: #16a34a; }
.wh-type-tag.franchise { background: rgba(240,183,90,.18); color: #d97706; }

/* ── 补货数量调整（+/- 按钮 + 输入框）── */
.qty-btn {
    width: 22px; height: 22px; border: 1px solid var(--border);
    background: var(--surface-1); color: var(--text);
    border-radius: 5px; cursor: pointer; font-size: 14px; line-height: 1;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0; transition: all .1s;
}
.qty-btn:hover { border-color: var(--primary); color: var(--primary); }
.qty-input {
    border: 1px solid var(--border); border-radius: 5px;
    background: var(--input-bg); color: var(--text);
}

/* ── 预算/额度受限标记 ── */
.budget-limit-badge {
    display: inline-block; margin-left: 4px; padding: 0 5px;
    background: rgba(240,106,111,.14); color: #dc2626;
    border-radius: 4px; font-size: 10px; font-weight: 500;
}

/* ── 权重配置 ── */
.weight-configs { display: flex; flex-direction: column; gap: 10px; }
.weight-row {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 14px; background: #fafbfe; border-radius: 10px;
    border: 1px solid var(--border);
}
.tbl-input {
    width: 76px; padding: 6px 10px; text-align: right;
    border: 1px solid #dcdfe8; border-radius: 8px; font-size: 13px;
}
.tbl-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,.12); }
.tbl-num { font-variant-numeric: tabular-nums; }

/* ── 行内编辑 ── */
.inline-edit {
    padding: 4px 8px; border: 1px solid transparent; border-radius: 8px;
    font-size: 13px; font-family: inherit; width: 100%;
}
.inline-edit:hover { border-color: var(--border); background: var(--surface-1); }
.date-input { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.note-input {
    padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 13px; font-family: inherit; width: 100%;
}

/* ── 保存表格 ── */
.saved-table-wrap { margin-top: 14px; overflow-x: auto; }
.saved-table-wrap .table { box-shadow: none; border: 1px solid var(--border); min-width: max-content; }
.saved-table-wrap .table thead { background: var(--surface-3); }
.saved-table-wrap .table thead th { background: var(--surface-3); }
.saved-table-wrap .table tbody td { background: var(--surface-1); }

/* ── 表格复选框列 ── */
.table th.cb-col, .table td.cb-col { width: 34px; text-align: center; }

/* ── 预警行 ── */
.table tr.row-need td { background: #fdf1e0; }
.table tr.row-low td { background: #fff8e6; }
.table tr:hover.row-need td { background: #fbe8cf; }
.table tr:hover.row-low td { background: #fdf0d0; }

/* ── 商品名展开单元格 ── */
.product-name-cell { max-width: 240px; position: relative; }
.product-name-cell .pnc-preview { display: flex; align-items: center; gap: 6px; }
.product-name-cell .pnc-full { display: none; }
.product-name-cell .pnc-toggle { cursor: pointer; color: var(--primary); }
.product-name-cell.has-toggle .pnc-preview { cursor: pointer; }
.product-name-cell.has-toggle .pnc-preview:hover { text-decoration: underline dotted; }
.product-name-cell.expanded .pnc-preview { display: none; }
.product-name-cell.expanded .pnc-full {
    display: block; padding: 8px 10px; background: #fafbfe;
    border-radius: 8px; border: 1px solid var(--border);
    white-space: normal; position: absolute; left: 0; right: 0; top: 30px;
    z-index: 5; box-shadow: var(--shadow);
}

/* ── 历史面板 ── */
.history-panel {
    background: var(--surface-1); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px 18px;
    margin-bottom: 20px; max-height: 300px; overflow-y: auto;
}
.history-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.history-item {
    display: flex; justify-content: space-between; gap: 14px; align-items: center;
    padding: 10px 14px; border-radius: 10px; background: #fafbfe;
    border: 1px solid var(--border);
}
.history-item:hover { background: #f4f6fd; }
.history-item .hi-search {
    font-size: 13px; font-weight: 500;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%;
}
.history-item .hi-meta { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }

/* ── 批次表 ── */
.batch-list-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.batch-list-table th {
    text-align: left; padding: 10px 12px; font-weight: 600;
    color: var(--text-muted); background: #f7f8fc;
    border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.batch-list-table td {
    padding: 10px 12px; border-bottom: 1px solid #f0f1f6;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px;
}
/* 操作列：允许换行、不裁切，否则末尾按钮（删除）会被 max-width/overflow 隐藏 */
.batch-list-table td.batch-actions {
    max-width: none; min-width: 180px; overflow: visible;
    white-space: normal; text-overflow: clip;
}
.batch-list-table td.batch-actions .btn { margin: 2px 4px 2px 0; }
.batch-list-table tbody tr:last-child td { border-bottom: none; }
.batch-list-table tbody tr { transition: background .1s; }
.batch-list-table tbody tr:hover { background: #f8f9fe; }
.batch-id-link { color: var(--primary); font-weight: 500; text-decoration: none; }
.batch-id-link:hover { text-decoration: underline; }
.batch-meta { font-size: 12px; color: var(--text-muted); }
.batch-tag {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600;
}
.batch-mini-stat {
    display: inline-block; padding: 2px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600;
}
.batch-mini-stat.pending { background: #fdf1e0; color: #b26a06; }
.batch-mini-stat.done { background: #e6f6ee; color: #0d8a4e; }
.batch-mini-stat.cancelled { background: #f1f2f6; color: #6b7280; }

/* 补货单整单状态徽标 */
.batch-status {
    display: inline-block; padding: 2px 10px; border-radius: 999px;
    font-size: 12px; font-weight: 600; white-space: nowrap;
}
.batch-status.draft { background: #f1f2f6; color: #6b7280; }
.batch-status.submitted { background: #fdf1e0; color: #b26a06; }
.batch-status.rejected { background: #fdecec; color: #c0392b; }
.batch-status.approved { background: #e6f6ee; color: #0d8a4e; }

.batch-breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; margin-bottom: 12px; color: var(--text-muted);
    flex-wrap: wrap;
}
.batch-breadcrumb .crumb { color: var(--text-muted); text-decoration: none; cursor: pointer; }
.batch-breadcrumb .crumb:hover { color: var(--primary); }
.batch-breadcrumb .crumb.current { color: var(--text); font-weight: 600; }
.batch-breadcrumb .sep { color: #c3c9d6; }
.batch-detail-header {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 10px; margin-bottom: 16px;
}

/* ── 侧栏用户区 ── */
.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px; border-top: 1px solid var(--border);
    flex-shrink: 0; background: #fafbfe;
}
.sb-avatar {
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--grad-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.sb-meta { min-width: 0; flex: 1; }
.sb-name {
    font-size: 13px; font-weight: 600; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb-role { font-size: 11.5px; color: var(--text-muted); }
.sb-logout {
    border: 1px solid var(--border); background: var(--surface-1); color: var(--text-muted);
    border-radius: 8px; padding: 4px 10px; font-size: 12px; cursor: pointer;
    transition: all .15s; flex-shrink: 0;
}
.sb-logout:hover { color: var(--danger); border-color: #f0b7b9; background: #fdf6f6; }

/* ── 其他辅助 ── */
.hint { font-size: 12px; color: var(--text-muted); }
.cols-hint { font-size: 12px; color: var(--text-muted); }

/* ── 响应式 ── */
@media (max-width: 768px) {
    .sidebar { width: 64px; }
    .sidebar-brand { justify-content: center; padding: 16px 8px; }
    .sidebar-brand span, .nav-item { font-size: 0; }
    .nav-item { justify-content: center; padding: 10px; }
    .nav-group-title { font-size: 0; padding: 10px 0 4px; text-align: center; }
    .sidebar-user { justify-content: center; padding: 12px 8px; }
    .sb-meta, .sb-logout { display: none; }
    .main { padding: 18px 14px 28px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .filter-bar { flex-direction: column; }
}

/* ── 暗黑模式：覆盖残留浅色硬编码（导航/hover/表头/徽章/状态标签等）── */
[data-theme="dark"] .nav-item { color: #9aa3b2; }
[data-theme="dark"] .nav-item:hover { background: var(--hover-bg); color: #e6e8ee; }
[data-theme="dark"] .table thead { background: var(--surface-3); }
[data-theme="dark"] .table thead th { background: var(--surface-3); color: var(--text-muted); }
[data-theme="dark"] .table tr:hover td { background: var(--hover-bg); }
[data-theme="dark"] .table tbody td { background: var(--surface-1); }

/* 徽章/状态标签：暗色下改为半透明底 + 亮字 */
[data-theme="dark"] .badge.green,
[data-theme="dark"] .lvl-badge.ok,
[data-theme="dark"] .status-tag.done,
[data-theme="dark"] .batch-mini-stat.done,
[data-theme="dark"] .status-msg.success { background: rgba(62, 207, 122, .15); color: #5fe08f; }
[data-theme="dark"] .badge.blue,
[data-theme="dark"] .lvl-badge.full,
[data-theme="dark"] .status-msg.loading { background: rgba(110, 168, 255, .15); color: #8db9ff; }
[data-theme="dark"] .badge.violet { background: rgba(167, 139, 250, .18); color: #b9a5ff; }
[data-theme="dark"] .badge.amber,
[data-theme="dark"] .lvl-badge.warn,
[data-theme="dark"] .lvl-badge.low,
[data-theme="dark"] .status-tag.pending,
[data-theme="dark"] .batch-mini-stat.pending,
[data-theme="dark"] .status-msg.warning { background: rgba(240, 183, 90, .16); color: #f2c272; }
[data-theme="dark"] .badge.red,
[data-theme="dark"] .lvl-badge.danger,
[data-theme="dark"] .status-msg.error { background: rgba(240, 106, 111, .16); color: #f58a8e; }
[data-theme="dark"] .badge.slate,
[data-theme="dark"] .status-tag.cancelled,
[data-theme="dark"] .batch-mini-stat.cancelled { background: var(--surface-3); color: #9aa3b2; }
[data-theme="dark"] .batch-status.draft { background: var(--surface-3); color: #9aa3b2; }
[data-theme="dark"] .batch-status.submitted { background: rgba(240, 183, 90, .16); color: #f2c272; }
[data-theme="dark"] .batch-status.rejected { background: rgba(240, 106, 111, .16); color: #f58a8e; }
[data-theme="dark"] .batch-status.approved { background: rgba(62, 207, 122, .15); color: #5fe08f; }

/* 预警行 */
[data-theme="dark"] .table tr.row-need td { background: rgba(240, 183, 90, .12); }
[data-theme="dark"] .table tr.row-low td { background: rgba(240, 183, 90, .08); }
[data-theme="dark"] .table tr:hover.row-need td { background: rgba(240, 183, 90, .18); }
[data-theme="dark"] .table tr:hover.row-low td { background: rgba(240, 183, 90, .14); }

/* 浅底区块 */
[data-theme="dark"] .repl-note,
[data-theme="dark"] .history-item,
[data-theme="dark"] .batch-mini,
[data-theme="dark"] .summary-box { background: var(--surface-2); }
[data-theme="dark"] .history-item:hover { background: var(--hover-bg); }
[data-theme="dark"] .sb-logout:hover { color: var(--danger); border-color: rgba(240,106,111,.4); background: rgba(240,106,111,.12); }
[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="file"],
[data-theme="dark"] select,
[data-theme="dark"] textarea { background: var(--input-bg); color: var(--text); }

/* 主题切换按钮（右上角悬浮） */
.theme-toggle {
    position: fixed; top: 16px; right: 20px; z-index: 999;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface-1); color: var(--text-muted);
    font-size: 12.5px; cursor: pointer; transition: all .15s;
    box-shadow: var(--shadow);
}
.theme-toggle:hover { color: var(--text); border-color: var(--primary); }
.theme-toggle svg { flex-shrink: 0; }

