/* 石材长线生产管理驾驶舱 —— 浅色现代 SaaS 风 */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg: #f4f6f8;          /* 页面底色 */
    --panel: #ffffff;       /* 卡片白 */
    --panel-2: #f7f9fc;     /* 浅填充：输入框/进度槽/隔行 */
    --line: #ebeef3;        /* 1px 浅边框 */
    --line-2: #e2e8f0;      /* 略深分隔线/坐标轴 */
    --text: #1f2733;        /* 主文字 */
    --text-2: #475569;      /* 次级文字 */
    --muted: #8a97a8;       /* 弱化文字 */
    --accent: #4263eb;      /* 主色 */
    --teal: #13b3a3;        /* 分类·青 */
    --purple: #8b5cf6;      /* 分类·紫 */
    --amber: #f5a623;       /* 分类·橙 */
    --green: #22ab6c;       /* 状态·正常 */
    --orange: #f5a623;      /* 状态·预警 */
    --red: #ef4444;         /* 状态·异常 */
    --shadow: 0 8px 24px -14px rgba(16, 24, 40, .12);   /* 柔和阴影 */
    --radius: 16px;         /* 卡片圆角 */
    --stripe: rgba(16, 24, 40, .018);                   /* 隔行底纹 */
    /* 数字用 Space Grotesk（系统未装则等宽回退）；中文走系统字体 */
    --mono: "Space Grotesk", ui-monospace, "SFMono-Regular", "Consolas", "Menlo", monospace;
    --num: "Space Grotesk", ui-monospace, "SFMono-Regular", "Consolas", "Menlo", monospace;
}
body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}
/* 数字统一启用等宽数字（tabular-nums），列对齐更整齐 */
.value, .num, .sc, .bal-v, .wc-big, .cyc-v, .anom-amt, .ship-since b,
.kpi-mom, .rt-num, .sb-right, .itbl .r, .pv span, .pd-row .r, .tt-row .num {
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

/* ---------- 登录页（二栏品牌面板 + 表单） ---------- */
.login-bg {
    display: flex; align-items: center; justify-content: center;
    padding: 24px; background: #070b12;
}
.login-card {
    display: flex; width: min(960px, 94vw); min-height: 580px;
    background: #0e1622; border: 1px solid #232f42;
    border-radius: 20px; overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
/* 左侧品牌面板：内容垂直居中、上下留白均衡 */
.login-brand {
    flex: 0 0 44%; position: relative; overflow: hidden;
    display: flex; align-items: center; padding: 0 56px;
    background: linear-gradient(160deg, #101c2e 0%, #0b1320 100%);
    border-right: 1px solid rgba(255,255,255,.05);
}
/* 顶部淡淡的同心圆弧装饰 */
.brand-deco {
    position: absolute; top: -120px; left: 30px;
    width: 360px; height: 360px; border-radius: 50%;
    border: 1px solid rgba(90,130,210,.10);
    box-shadow: 0 0 0 60px rgba(90,130,210,.04);
    pointer-events: none;
}
.brand-inner { position: relative; z-index: 1; }
.brand-logo {
    width: 84px; height: 84px; border-radius: 20px;
    display: grid; place-items: center; margin-bottom: 32px;
    background: linear-gradient(145deg, #3b82f6, #2563eb);
    box-shadow: 0 10px 28px rgba(37,99,235,.45);
}
.brand-title {
    font-size: 40px; line-height: 1.28; font-weight: 700;
    color: #f4f7fb; letter-spacing: 1px;
}
.brand-tag { margin-top: 22px; font-size: 18px; color: #56708f; }
/* 右侧表单：同样垂直居中 */
.login-form {
    flex: 1; display: flex; align-items: center;
    padding: 0 60px; background: #121a28;
}
.form-inner { width: 100%; max-width: 380px; margin: 0 auto; }
.form-title { font-size: 30px; font-weight: 700; color: #f4f7fb; }
.form-sub { margin: 10px 0 28px; font-size: 15px; color: #6b7c93; }
.login-form label {
    display: block; font-size: 14px; color: #8593a6; margin: 18px 0 8px;
}
.field { position: relative; }
.field-icon {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    width: 18px; height: 18px; color: #8a99b3; pointer-events: none;
}
.login-form input {
    width: 100%; padding: 14px 14px 14px 44px; border-radius: 10px;
    border: 1px solid #34435a; background: #18233563;
    color: #eef2f8; font-size: 15px; transition: border-color .15s, box-shadow .15s;
}
.login-form input::placeholder { color: #7587a0; }
.login-form input:hover { border-color: #43546e; }
.login-form input:focus {
    outline: none; border-color: #4263eb; background: #1b2740; box-shadow: 0 0 0 3px rgba(66,99,235,.18);
}
.login-form button {
    width: 100%; margin-top: 28px; padding: 15px; border: none; border-radius: 10px;
    background: #2563ff; color: #fff; font-size: 17px; letter-spacing: 6px; font-weight: 600;
    cursor: pointer; transition: background .2s;
}
.login-form button:hover { background: #3b78ff; }
.login-error {
    background: rgba(231,76,60,.15); color: #ff8c7a;
    border: 1px solid rgba(231,76,60,.4); border-radius: 8px;
    padding: 10px; font-size: 13px; text-align: center; margin-bottom: 6px;
}
.form-foot { text-align: center; margin-top: 18px; color: #5a6b82; font-size: 13px; }
/* 窄屏：隐藏左侧品牌面板，仅留表单 */
@media (max-width: 720px) {
    .login-card { width: 94vw; min-height: 0; }
    .login-brand { display: none; }
    .login-form { padding: 40px 28px; }
}

/* ---------- 应用外壳：左侧边栏 + 主列 ---------- */
.app { display: flex; min-height: 100vh; }

/* 左侧细图标侧边栏 */
.sidebar {
    width: 136px; flex: 0 0 136px; background: var(--panel);
    border-right: 1px solid var(--line); position: sticky; top: 0; height: 100vh;
    display: flex; flex-direction: column; align-items: center; padding: 18px 0; gap: 8px;
    z-index: 20; overflow-y: auto; overflow-x: hidden;
}
.side-logo {
    width: 54px; height: 54px; border-radius: 17px; margin-bottom: 10px; flex-shrink: 0;
    display: grid; place-items: center; color: #fff;
    background: linear-gradient(145deg, #5b7cf6, var(--accent));
    box-shadow: 0 18px 34px -20px rgba(66, 99, 235, .85);
}
.sidebar .tabs { display: flex; flex-direction: column; gap: 6px; width: 100%; align-items: center; flex-shrink: 0; padding: 4px 0 18px; }
.sidebar .tab {
    --dock-scale: 1;
    --dock-x: 0px;
    --dock-y: 0px;
    width: 112px; height: 82px; padding: 0; border-radius: 22px; cursor: pointer; user-select: none;
    display: grid; place-items: center;
    color: var(--muted); font-size: 11px; transition: color .12s ease;
    position: relative; isolation: isolate;
}
.sidebar .tab svg {
    width: 30px; height: 30px; padding: 17px; border-radius: 22px; background: var(--panel-2);
    color: var(--muted); box-sizing: content-box;
    box-shadow: 0 10px 24px -22px rgba(16,24,40,.22), inset 0 0 0 1px rgba(255,255,255,.55);
    backface-visibility: hidden;
}   /* 圆角色块图标：正式侧栏采用 Mac Dock 式放大，文字不参与排版 */
.sidebar .tab span {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
/* 各页配色色块——质感来源，呼应演示的彩色 Dock */
.sidebar .tab[data-page="home"] svg, .sidebar .tab[data-page="p1"] svg { background: rgba(66,99,235,.12); color: #3a5bd9; }
.sidebar .tab[data-page="pq"] svg { background: rgba(19,179,163,.14); color: #0e7d72; }
.sidebar .tab[data-page="id"] svg { background: rgba(139,92,246,.14); color: #6b3fd4; }
.sidebar .tab[data-page="ic"] svg { background: rgba(245,166,35,.16); color: #9a6406; }
.sidebar .tab[data-page="dq"] svg { background: rgba(34,171,108,.14); color: #15875a; }
.sidebar .tab[data-page="mat"] svg { background: rgba(239,68,68,.13); color: #c5302e; }
.sidebar .tab:hover { color: var(--text-2); }
.sidebar .tab.active { color: var(--text); }
.sidebar .tab.active svg {
    color: #fff; background: linear-gradient(145deg, #5b7cf6, var(--accent));
    box-shadow: 0 24px 42px -24px rgba(66,99,235,.85), inset 0 0 0 1px rgba(255,255,255,.42);
}
.sidebar .tab.disabled { opacity: .4; cursor: not-allowed; }

/* 主列 */
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* 顶部标题栏 */
.topbar {
    display: flex; align-items: center; gap: 20px;
    background: var(--panel); border-bottom: 1px solid var(--line);
    padding: 0 32px; height: 64px; position: sticky; top: 0; z-index: 15;
}
.page-name { font-size: 19px; font-weight: 700; color: var(--text); white-space: nowrap; }
.brand { font-size: 15px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.userbox { display: flex; align-items: center; gap: 18px; font-size: 13px; margin-left: auto; }
.update-time { color: var(--muted); font-family: var(--mono); font-size: 12px; white-space: nowrap; }
.who { color: var(--text-2); white-space: nowrap; }
/* 顶栏空间不够时优先隐藏更新时间，保住按钮 */
@media (max-width: 1080px) { .topbar .update-time { display: none; } }
@media (max-width: 880px) { .topbar .who { display: none; } }
.btn-link { color: var(--accent); text-decoration: none; }
.btn-link:hover { text-decoration: underline; }
/* 顶栏右侧大按钮：上传数据 / 中控 / 退出 */
.top-btn {
    display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
    padding: 9px 16px; border-radius: 10px; font-size: 14px; font-weight: 600;
    text-decoration: none; cursor: pointer; transition: all .15s ease;
    border: 1px solid var(--line); color: var(--text-2); background: var(--panel-2);
}
.top-btn svg { width: 16px; height: 16px; }
.top-btn:hover { background: #eef2ff; color: var(--accent); border-color: var(--accent); transform: translateY(-1px); }
.top-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 6px 16px -8px rgba(66,99,235,.6); }
.top-btn.primary:hover { background: #3454d4; color: #fff; }
.top-btn.logout:hover { background: rgba(239,68,68,.1); color: var(--red); border-color: var(--red); }

/* 内容区：1320 居中、两侧留白 */
.content { max-width: 1320px; width: 100%; margin: 0 auto; padding: 28px 32px 40px; }

/* ---------- 筛选条 ---------- */
.filters {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    padding: 14px 32px; background: var(--panel);
    border-bottom: 1px solid var(--line);
}
.filters label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.filters label .flt-hint { font-size: 10px; color: var(--accent); background: #eef2ff; border-radius: 5px; padding: 1px 5px; font-weight: 600; }
.cn-date { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 14px; width: 130px; cursor: pointer; }
.cn-date::placeholder { color: var(--muted); }
.date-pop { position: absolute; z-index: 50; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px; box-shadow: 0 12px 32px -10px rgba(16,24,40,.18); width: 240px; }
.dp-head { display: flex; justify-content: space-between; align-items: center; color: var(--text); font-size: 14px; padding: 2px 4px 8px; }
.dp-nav { cursor: pointer; color: var(--accent); font-size: 20px; padding: 0 8px; user-select: none; }
.dp-sel { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; font-size: 14px; cursor: pointer; }
.dp-wd { display: grid; grid-template-columns: repeat(7, 1fr); color: var(--muted); font-size: 12px; text-align: center; }
.dp-wd i { padding: 4px 0; font-style: normal; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.dp-c { font-style: normal; text-align: center; padding: 6px 0; font-size: 13px; color: var(--text); border-radius: 6px; cursor: pointer; }
.dp-c.empty { cursor: default; }
.dp-c:not(.empty):hover { background: var(--panel-2); }
.dp-c.on { background: var(--accent); color: #fff; }
.dp-foot { text-align: right; padding-top: 6px; }
.dp-clear { color: var(--muted); font-size: 12px; cursor: pointer; }
.dp-clear:hover { color: var(--accent); }

.filters select {
    background: var(--panel); color: var(--text);
    border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 14px;
}
.filters button {
    background: var(--accent); color: #fff; border: none; border-radius: 6px;
    padding: 7px 16px; font-size: 14px; cursor: pointer;
}
.filters button.ghost { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.row-count { margin-left: auto; color: var(--muted); font-size: 13px; font-family: var(--mono); }

/* ---------- 页面 ---------- */
.page { padding: 0; }
.page > section, .page > .kpi-grid, .page > .alert-bar,
.page > .p1-bar, .page > .inv-page-title, .page > .muted, .page > .inv-legend {
    margin-bottom: 24px;          /* 板块之间统一呼吸间距 */
}

/* KPI 卡 */
.kpi-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
    gap: 20px; margin-bottom: 24px;
}
/* 库存与资金 KPI：固定每行 4 张（8 卡=上 4 下 4） */
#icKpi { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) { #icKpi { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { #icKpi { grid-template-columns: 1fr; } }
.kpi-card {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px 22px; box-shadow: var(--shadow);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
/* .kpi-card hover 抬起已统一到 components.css 文末 --elev-hover 规则 */
/* 图标行：图标方块（左） + 状态徽标（右） */
.kpi-head { display: flex; align-items: center; justify-content: space-between; min-height: 38px; margin-bottom: 14px; }
.kpi-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
    background: #eef2ff; color: var(--accent); }
.kpi-ic svg { width: 19px; height: 19px; }
.kpi-card.green .kpi-ic { background: rgba(34,171,108,.12); color: var(--green); }
.kpi-card.orange .kpi-ic { background: rgba(245,166,35,.13); color: var(--orange); }
.kpi-card.red .kpi-ic { background: rgba(239,68,68,.12); color: var(--red); }
.kpi-card .label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.kpi-card .value { font-size: 31px; font-weight: 700; font-family: var(--num); color: var(--text); line-height: 1.1; letter-spacing: -.5px; }
.kpi-card .unit { font-size: 13px; color: var(--muted); margin-left: 4px; font-weight: 600; font-family: -apple-system, "PingFang SC", sans-serif; letter-spacing: 0; }
.kpi-card.green .value { color: var(--green); }
.kpi-card.orange .value { color: var(--orange); }
.kpi-card.red .value { color: var(--red); }

/* 图表卡 */
.chart-row {
    display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; margin-bottom: 24px;
}
.chart-card {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 24px; box-shadow: var(--shadow);
    transition: box-shadow .18s ease, border-color .18s ease;
    contain: layout;   /* 布局隔离：单卡内部变化不触发整页重排，切页/滚动更顺（不裁剪，不影响 tooltip） */
}
/* .chart-card hover 抬起已统一到 components.css 文末 --elev-hover 规则 */
/* 标题：粗体主标题 + 小灰字口径说明（由 JS 自动拆分括号） */
.chart-title { font-size: 15.5px; color: var(--text); margin-bottom: 18px; font-weight: 700; line-height: 1.5; }
.chart-title .ct-h { font-weight: 700; }
.chart-title .ct-cap { display: block; margin-top: 5px; font-size: 12px; font-weight: 400; color: var(--muted); line-height: 1.55; }
.chart-row.single { grid-template-columns: 1fr; }
.chart-body { width: 100%; height: 320px; }
.chart-body.tall { height: 440px; }

/* 数据质量页 */
.dq-table { padding: 4px 0; }
.dq-row { display: flex; justify-content: space-between; padding: 10px 6px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--text); }
.dq-row b { font-family: var(--mono); }
.dq-row b.warn { color: var(--orange); }
.dq-rules { font-size: 13px; line-height: 1.9; color: var(--muted); }
.dq-rule { padding: 2px 0; }

/* KPI 副说明 */
.kpi-sub { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.5; word-break: break-all; }
.kpi-card.clickable { cursor: pointer; }
.kpi-card.clickable:hover { border-color: var(--accent); }
/* KPI 环比 */
.kpi-mom { font-size: 11px; margin-top: 6px; font-family: var(--mono); }
.kpi-mom.ok { color: var(--green); }
.kpi-mom.bad { color: var(--red); }
.kpi-mom.muted { color: var(--muted); }

/* 待入库滞留清单 */
.pd-head, .pd-row { display: grid; grid-template-columns: 1.6fr .7fr 1.4fr 1.1fr .9fr; gap: 12px; padding: 9px 10px; align-items: center; font-size: 13px; }
.pd-head { color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.pd-head .c, .pd-row .c { text-align: center; }
.pd-head .r, .pd-row .r { text-align: right; font-family: var(--mono); }
.pd-body { max-height: 360px; overflow-y: auto; }
.pd-row { border-bottom: 1px solid var(--line); color: var(--text); }
.pd-row .pd-bn { font-family: var(--mono); }
.pd-row:nth-child(even) { background: var(--stripe); }
.pd-row.danger { background: rgba(231,76,60,.12); }
.pd-row.danger span { color: #ff8c7a !important; }
.kpi-card { position: relative; display: flex; flex-direction: column; }
/* 环比/底注统一贴卡底，跨卡对齐 */
.kpi-mom { margin-top: auto; }
#kpiDeadCapital .kpi-sub { margin-top: auto; }
.kpi-badge { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.kpi-badge.ok { color: var(--green); background: rgba(34,171,108,.12); }
.kpi-badge.warn { color: var(--orange); background: rgba(245,166,35,.13); }
.kpi-badge.bad { color: var(--red); background: rgba(239,68,68,.12); }

/* 目标达成表 */
.target-table { font-size: 14px; }
.tt-head, .tt-row { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr 1fr; gap: 8px; padding: 9px 6px; align-items: center; }
.tt-head { color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.tt-head .r { text-align: right; }
.tt-head .c { text-align: center; }
.tt-row { border-bottom: 1px solid var(--line); color: var(--text); }
.tt-row .num { font-family: var(--mono); text-align: right; }
.tt-row .judge { text-align: center; }
.tt-row .num.ok { color: var(--green); }
.tt-row .num.bad { color: var(--red); }
.tt-row .num.muted { color: var(--muted); }
.judge { font-size: 13px; text-align: center; }
.judge.ok { color: var(--green); }
.judge.warn { color: var(--orange); }
.judge.bad { color: var(--red); }

/* 损失概览 */
.loss-panel { font-size: 14px; }
.loss-row { display: grid; grid-template-columns: 1.2fr 1fr 1.1fr 1.4fr; gap: 8px; padding: 11px 6px; border-bottom: 1px solid var(--line); align-items: center; }
.loss-row .ln { color: var(--text); }
.loss-row .num { font-family: var(--mono); text-align: right; font-weight: 600; }
.loss-row .num.bad { color: var(--red); }
.loss-row .num.warn { color: var(--orange); }
.loss-row .num.ok { color: var(--green); }
.loss-row .lnote { color: var(--muted); font-size: 12px; text-align: right; }
.loss-total { margin-top: 12px; padding: 12px; background: rgba(243,156,18,.12); border: 1px solid rgba(243,156,18,.35); border-radius: 8px; color: var(--orange); font-size: 14px; text-align: center; }
/* 损失概览 5 卡（图标+大数+环比+底部 sparkline） */
.loss-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; }
.loss-card { padding: 18px; }
.loss-card .kpi-head { display: flex; align-items: center; justify-content: space-between; }
.loss-card .value { font-size: 24px; }
.loss-card .spark-wrap { margin-top: 14px; }
/* 主 KPI 卡底部迷你趋势线 */
.kpi-card .spark-wrap { margin-top: 10px; }
.spark { width: 100%; height: 30px; display: block; }
.spark-empty { height: 30px; display: flex; align-items: center; font-size: 11px; color: var(--muted); }
.loss-note { font-size: 12px; margin-top: 14px; text-align: center; }

/* 目标头部条 */
.goal-bar { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 22px; margin-bottom: 24px; }
.goal-h { font-size: 15px; font-weight: 700; color: var(--text); }
.goal-items { font-size: 13px; color: var(--text-2); font-weight: 600; }
.goal-items i { color: var(--line-2); font-style: normal; margin: 0 10px; }
.goal-legend { margin-left: auto; display: flex; gap: 16px; }
.gl { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.gl::before { content: ""; width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.gl.ok::before { background: var(--green); } .gl.warn::before { background: var(--orange); } .gl.bad::before { background: var(--red); }
/* 各设备质量指标对比 → 4 子卡（含目标刻度线） */
.qm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.qm-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.qm-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.qm-ic { width: 34px; height: 34px; border-radius: 10px; background: #eef2ff; color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.qm-ic svg { width: 17px; height: 17px; }
.qm-ht { min-width: 0; }
.qm-t { font-size: 14px; font-weight: 700; color: var(--text); white-space: nowrap; }
.qm-tg { font-size: 12px; color: var(--muted); margin-top: 1px; white-space: nowrap; }
.qm-bars { position: relative; padding-top: 22px; }
.qm-tick { position: absolute; top: 22px; bottom: 5px; width: 0; border-left: 1px dashed #9aa4b4; z-index: 1; }
.qm-tick span { position: absolute; top: -19px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; color: var(--accent); white-space: nowrap; }
.qm-row { display: grid; grid-template-columns: 32px 1fr 52px; gap: 8px; align-items: center; margin: 9px 0; }
.qm-dev { font-size: 13px; color: var(--text-2); font-weight: 600; }
.qm-track { height: 12px; background: #eef1f6; border-radius: 7px; overflow: hidden; }
.qm-fill { height: 100%; border-radius: 7px; transition: width .4s ease; }
.qm-fill.ok { background: var(--green); } .qm-fill.warn { background: var(--orange); } .qm-fill.bad { background: var(--red); } .qm-fill.muted { background: var(--muted); }
.qm-val { text-align: right; font-family: var(--num); font-size: 14px; font-weight: 700; }
.qm-val.ok { color: var(--green); } .qm-val.warn { color: var(--orange); } .qm-val.bad { color: var(--red); } .qm-val.muted { color: var(--muted); }
.card-note { margin-top: 14px; padding: 10px 13px; background: var(--panel-2); border-radius: 8px; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.note-ok { background: rgba(34,171,108,.10); color: #1c8f5a; }
.note-warn { background: rgba(245,166,35,.12); color: #b97400; }
.note-info { background: rgba(66,99,235,.07); color: var(--text-2); }
@media (max-width: 1100px) { .qm-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 620px) { .qm-grid { grid-template-columns: 1fr; } }

/* 质量分配：环形 + 侧表 */
.qd-wrap { display: flex; align-items: center; gap: 20px; }
.qd-ring { width: 210px; height: 230px; flex-shrink: 0; }
.qd-table { flex: 1; min-width: 0; }
.qd-head, .qd-row { display: grid; grid-template-columns: 1.2fr 1fr .7fr; gap: 8px; align-items: center; padding: 11px 4px; }
.qd-head { color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); }
.qd-row { border-bottom: 1px solid var(--line); font-size: 14px; }
.qd-row:last-child { border-bottom: none; }
.qd-name { display: inline-flex; align-items: center; gap: 8px; color: var(--text); font-weight: 600; }
.qd-name i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.qd-head .r, .qd-row .r { text-align: right; font-family: var(--num); }
.qd-row .b { font-weight: 700; color: var(--text); }
@media (max-width: 560px) { .qd-wrap { flex-direction: column; } .qd-ring { width: 100%; } }

/* P2 设备质量胶囊条（Excel 风格 含目标线） */
.bullet-wrap { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 26px; }
.bl-metric { }
.bl-title { font-size: 14px; color: var(--text); margin-bottom: 10px; font-weight: 600; }
.bl-title em { color: var(--muted); font-size: 12px; font-style: normal; margin-left: 6px; }
.bl-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.bl-dev { width: 28px; color: var(--muted); font-size: 13px; }
.bl-track { position: relative; flex: 1; height: 22px; background: var(--panel-2); border-radius: 11px; }
.bl-fill { height: 100%; border-radius: 11px; transition: width .3s; }
.bl-target { position: absolute; top: -3px; bottom: -3px; width: 0; border-left: 2px dashed var(--muted); }
.bl-val { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 13px; font-weight: 700; }

/* 设备驾驶位（竖排卡：名+徽标 / 大环形分数 / 2×2 指标） */
.hg-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.hg-card { display: flex; flex-direction: column; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); }
.hg-head { display: flex; align-items: center; justify-content: space-between; }
.hg-name { font-size: 16px; font-weight: 700; color: var(--text); }
/* .hg-badge 已统一为 .tag(D2 清理) */
.hg-ring { width: 100%; height: 170px; margin: 6px 0 14px; }
.hg-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; border-top: 1px solid var(--line); padding-top: 16px; }
.hg-ml { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.hg-mv { font-size: 17px; font-weight: 700; color: var(--text); font-family: var(--num); }
@media (max-width: 1000px) { .hg-grid { grid-template-columns: 1fr; } }

/* 生产节拍带 */
.cad-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.cad-wrap { display: flex; flex-direction: column; gap: 10px; }
.cad-row { display: flex; align-items: center; gap: 14px; }
.cad-dev { width: 34px; flex-shrink: 0; font-size: 13px; font-weight: 700; color: var(--text); }
.cad-track { flex: 1; display: flex; gap: 3px; min-width: 0; }
.cad-cell { flex: 1; height: 26px; min-width: 5px; border-radius: 5px; background: #dde2ea; }
.cad-rate { width: 54px; flex-shrink: 0; text-align: right; font-family: var(--num); font-size: 19px; font-weight: 700; }
.cad-rate.ok { color: var(--teal); } .cad-rate.warn { color: var(--orange); } .cad-rate.bad { color: var(--red); }
.cad-axis { display: flex; align-items: center; gap: 14px; margin-top: 2px; }
.cad-axis-line { flex: 1; position: relative; height: 16px; }
.cad-axis-line span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--muted); }
.cad-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-top: 20px; }
.cad-stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 13px 16px; }
.cs-l { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.cs-v { font-size: 19px; font-weight: 700; font-family: var(--num); color: var(--text); }
.cs-v.bad { color: var(--red); }

/* 目标达成 → 过线压力 */
.gate-row { display: grid; grid-template-columns: 158px 1fr 92px; gap: 16px; align-items: center; padding: 12px 16px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; background: var(--panel-2); }
.gate-row:last-child { margin-bottom: 0; }
.gate-head b { display: block; font-size: 14px; font-weight: 700; color: var(--text); }
.gate-head span { font-size: 12px; color: var(--muted); }
.gate-bar { position: relative; }
.gate-track { height: 14px; background: #e8ecf2; border-radius: 8px; overflow: hidden; }
.gate-fill { height: 100%; border-radius: 8px; transition: width .4s ease; }
.gate-fill.ok { background: var(--green); } .gate-fill.warn { background: var(--orange); } .gate-fill.bad { background: var(--red); }
.gate-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #7a8699; border-radius: 1px; }
.gate-val { text-align: right; font-family: var(--num); font-size: 18px; font-weight: 700; }
.gate-val.ok { color: var(--green); } .gate-val.warn { color: var(--orange); } .gate-val.bad { color: var(--red); } .gate-val.muted { color: var(--muted); }

/* 待入库滞留 → 三泳道 */
/* 待入库队列顶部 设备/型号 汇总 */
.pd-summary { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.pd-sum-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.pd-sum-lab { font-size: 12px; color: var(--muted); min-width: 76px; }
.pd-chip { font-size: 12px; color: var(--text-2); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 3px 11px; }
.pd-chip b { color: var(--text); font-weight: 600; }
.pd-chip.strong { color: var(--accent); border-color: var(--accent); font-weight: 700; font-family: var(--num); }
.sw-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.sw-lane { background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.sw-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.sw-name { font-size: 14px; font-weight: 700; }
.sw-name.bad { color: var(--red); } .sw-name.warn { color: var(--orange); } .sw-name.ok { color: var(--green); }
.sw-range { font-size: 12px; color: var(--muted); }
.sw-body { display: flex; flex-direction: column; gap: 10px; max-height: 340px; overflow-y: auto; }
.sw-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; border-left: 3px solid var(--line); }
.sw-card.bad { border-left-color: var(--red); background: rgba(239,68,68,.04); }
.sw-card.warn { border-left-color: var(--orange); background: rgba(245,166,35,.05); }
.sw-card.ok { border-left-color: var(--green); }
.sw-top { display: flex; justify-content: space-between; align-items: center; }
.sw-bn { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--text); }
.sw-days { font-family: var(--num); font-size: 20px; font-weight: 700; }
.sw-days.bad { color: var(--red); } .sw-days.warn { color: var(--orange); } .sw-days.ok { color: var(--green); }
.sw-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* 库存资金 KPI 大数字稍缩，长金额不溢出 */
#icKpi .value { font-size: 25px; }
@media (max-width: 1000px) { .cad-stats, .sw-grid { grid-template-columns: 1fr 1fr; } }

/* P3 规格质量表 */
/* 规格质量指标矩阵 */
.sm-legend { display: flex; gap: 28px; flex-wrap: wrap; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin-bottom: 18px; }
.sm-lg { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.sm-lg i { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.sm-lg i.ok { background: var(--green); } .sm-lg i.warn { background: var(--orange); } .sm-lg i.bad { background: var(--red); }
.sm-lg b { color: var(--text); font-weight: 700; }
.sm-lg em { color: var(--muted); font-style: normal; font-size: 12px; }
.sm-head, .sm-row { display: grid; grid-template-columns: 1.3fr .6fr repeat(5, 1.1fr) .8fr; gap: 12px; align-items: center; }
.sm-head { color: var(--muted); font-size: 13px; padding: 12px 6px; border-bottom: 1px solid var(--line); }
.sm-head .c, .sm-row .c { text-align: center; }
.sm-row { padding: 16px 6px; border-bottom: 1px solid var(--line); }
.sm-row:last-child { border-bottom: none; }
.sm-spec { font-size: 15px; font-weight: 700; color: var(--text); }
.sm-batch { font-family: var(--num); color: var(--text-2); }
.sm-v { font-family: var(--num); font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.sm-v.ok { color: var(--green); } .sm-v.warn { color: var(--orange); } .sm-v.bad { color: var(--red); }
.sm-bar { height: 7px; background: #eef1f6; border-radius: 4px; overflow: hidden; }
.sm-bar i { display: block; height: 100%; border-radius: 4px; }
.sm-bar i.ok { background: var(--green); } .sm-bar i.warn { background: var(--orange); } .sm-bar i.bad { background: var(--red); }
/* .sm-badge 已统一为 .tag(D2 清理) */

.spec-table { font-size: 14px; }
.st-head, .st-row { display: grid; grid-template-columns: 1.4fr .7fr 1fr 1fr 1fr 1fr 1fr; padding: 10px 6px; align-items: center; }
.st-head { color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.st-row { border-bottom: 1px solid var(--line); }
.st-name { color: var(--text); font-weight: 600; }
.st-row .num { font-family: var(--mono); color: var(--muted); text-align: center; }
.sc { font-family: var(--mono); font-weight: 700; text-align: center; }
.sc.ok { color: var(--green); }
.sc.warn { color: var(--orange); }
.sc.bad { color: var(--red); }

/* 中控台 */
.ctrl-table { margin-top: 8px; }
.ct-head, .ct-row { display: grid; grid-template-columns: 1.2fr 1.2fr 1.6fr; gap: 12px; padding: 9px 4px; align-items: center; }
.ct-head { color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.ct-row { border-bottom: 1px solid var(--line); color: var(--text); }
.ct-row input { width: 110px; padding: 7px 9px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; color: var(--text); }
.ct-row em { color: var(--muted); font-style: normal; margin-left: 6px; }
.ct-row select { padding: 7px 9px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; color: var(--text); }
.ctrl-params { display: flex; gap: 22px; flex-wrap: wrap; margin: 12px 0; }
.ctrl-params label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
.ctrl-params input { width: 160px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; color: var(--text); }
.ctrl-actions { max-width: 900px; margin: 0 auto; padding: 0 28px 28px; display: flex; align-items: center; gap: 16px; }
.ctrl-actions button { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 11px 26px; font-size: 15px; cursor: pointer; }

/* 阶段五：统一进销/库存表格组件 */
.itbl { width: 100%; }
.itbl-head, .itbl-row { display: grid; gap: 12px; align-items: center; }
.itbl-head { padding: 9px 8px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.itbl-row { padding: 10px 8px; font-size: 13px; color: var(--text); border-bottom: 1px solid var(--line); }
.itbl-row:nth-child(even) { background: var(--stripe); }
.itbl-head > span, .itbl-row > span { min-width: 0; }
/* 文本列超长省略；数字/分档列永不裁剪 */
.itbl-row > span:not(.r):not(.c) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.itbl .r { text-align: right; font-family: var(--mono); white-space: nowrap; }
.itbl .c { text-align: center; white-space: nowrap; }
.itbl .c { text-align: center; }
.itbl .sub { color: var(--muted); font-size: 11px; }
.itbl .ok { color: var(--green); }
.itbl .warn { color: var(--orange); }
.itbl .bad { color: var(--red); }
.itbl-body { } /* maxHeight 由 JS 控制 */
.abc { display: inline-block; min-width: 22px; font-weight: 700; }
.abc-A { color: var(--red); }
.abc-B { color: var(--orange); }
.abc-C { color: var(--green); }

/* 阶段五 v2：三产品线布局 */
.inv-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.inv-sub { font-size: 13px; color: var(--text); font-weight: 600; margin-bottom: 4px; }
/* 月度入出 底部总量页脚 */
.mon-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.mf-cell { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 10px; font-size: 13px; min-width: 0; }
.mf-in { background: rgba(34,171,108,.08); }
.mf-out { background: rgba(66,99,235,.08); }
.mf-i { display: inline-flex; flex-shrink: 0; }
.mf-i svg { width: 16px; height: 16px; }
.mf-in .mf-i { color: var(--green); }
.mf-out .mf-i { color: var(--accent); }
.mf-l { color: var(--muted); white-space: nowrap; }
.mf-v { margin-left: auto; font-family: var(--num); font-weight: 700; }
.mf-in .mf-v { color: var(--green); }
.mf-out .mf-v { color: var(--accent); }
.ct-note { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 8px; }

/* 横向堆叠条 */
.inv-bars { display: flex; flex-direction: column; gap: 14px; padding: 6px 0; }
.sb-row { display: grid; grid-template-columns: 200px 1fr auto; gap: 14px; align-items: center; }
.sb-label { font-size: 13px; color: var(--text); }
.sb-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.sb-track { display: flex; height: 26px; border-radius: 5px; overflow: hidden; background: var(--panel-2); }
.sb-seg { display: flex; align-items: center; justify-content: center; font-size: 11px; color: #0f1419; font-weight: 700; min-width: 0; overflow: hidden; white-space: nowrap; }
.sb-right { font-size: 12px; color: var(--muted); font-family: var(--mono); white-space: nowrap; }
.sb-right .bad { color: var(--red); }
.inv-legend { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.lg-item { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.lg-item i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* SKU 评级表（.rate-badge 已统一为 .tag，D2 清理） */
.sku-cards { grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); }
.sku-cards .chart-card { padding: 18px; }
.rt-row { display: grid; grid-template-columns: minmax(84px,1.2fr) 48px 50px 72px 42px 48px; gap: 6px; align-items: center; padding: 8px 2px; border-bottom: 1px solid var(--line); font-size: 12px; }   /* 趋势/评级列加宽以容纳 .tag 药丸 */
.rt-head { color: var(--muted); font-size: 11px; }
.rt-sku { color: var(--text); font-size: 11px; line-height: 1.3; word-break: break-word; }
.rt-num { text-align: right; font-family: var(--mono); }
.rt-num.sub { color: var(--muted); font-size: 12px; }
.rt-trend { font-size: 12px; }   /* 趋势色已统一为 .tag(.up/.down/.flat 已删，D2 清理) */

/* 发货节奏预警 */
.ship-3col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 18px; }
.ship-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 14px; }
.ship-head { display: flex; justify-content: space-between; align-items: center; }
.ship-head b { color: var(--text); font-size: 14px; }
.ship-sub { color: var(--muted); font-size: 12px; margin: 8px 0; }
.ship-since { color: var(--text); font-size: 14px; }
.ship-since b { font-family: var(--mono); font-size: 22px; }
.ship-since b.warn { color: var(--orange); }
.ship-since b.bad { color: var(--red); }
.ship-line { position: relative; height: 24px; margin: 14px 0 4px; border-bottom: 1px solid var(--line); }
.ship-line i { position: absolute; top: 4px; width: 2px; height: 16px; }
.ship-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; }

/* 产存平衡 */
.bal-head, .bal-row { display: grid; grid-template-columns: 1.3fr 1fr .9fr .9fr 70px 1.2fr 1fr; gap: 12px; align-items: center; padding: 10px 6px; border-bottom: 1px solid var(--line); }
.bal-head { color: var(--muted); font-size: 12px; }
.bal-name { color: var(--text); font-size: 14px; font-weight: 600; }
.bal-sub { color: var(--muted); font-size: 11px; font-weight: 400; margin-top: 2px; }
.bal-v { font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--text); }
.bal-v.ok { color: var(--green); } .bal-v.warn { color: var(--orange); }
.bal-v .u { font-size: 11px; color: var(--muted); margin-left: 3px; }
.bal-l { font-size: 11px; color: var(--muted); margin-top: 2px; }
.bal-spark { height: 40px; }
.spark-svg { width: 100%; height: 40px; display: block; }

/* 进销页内分区小标题 */
.inv-page-title { font-size: 14px; font-weight: 700; color: var(--accent); padding: 4px 2px 2px; }

/* P1 预警条 / 标题栏 / 导出按钮 */
.alert-bar { margin: 0; padding: 14px 18px; background: rgba(239,68,68,.10); border: 1px solid rgba(239,68,68,.5); border-radius: 12px; color: #c0392b; font-size: 14px; font-weight: 600; }
.p1-bar { display: flex; justify-content: flex-end; align-items: center; padding: 0; }
.p1-title { display: none; }
.p1-title { font-size: 16px; font-weight: 600; color: var(--text); }
.btn-export { background: var(--accent); color: #fff; border: none; border-radius: 8px; padding: 9px 18px; font-size: 14px; cursor: pointer; }
.btn-export { transition: background .15s ease, transform .1s ease; }
.btn-export:hover { background: #3552d4; }
.btn-export:active { transform: translateY(1px); }

/* 周期双行卡 */
.cyc-row { display: flex; align-items: baseline; gap: 8px; margin-top: 8px; }
.cyc-v { font-family: var(--mono); font-size: 19px; font-weight: 700; color: var(--text); }
.cyc-v i { font-size: 11px; color: var(--muted); font-style: normal; margin-left: 2px; }
.cyc-l { font-size: 11px; color: var(--muted); }

/* 异常损失 Top3 */
.anom-top3 { display: flex; flex-direction: column; gap: 10px; }
.anom-card { display: grid; grid-template-columns: 36px 1fr auto; gap: 12px; align-items: center; padding: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; border-left: 4px solid var(--red); }
.anom-rank { width: 28px; height: 28px; border-radius: 50%; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.anom-cat { font-size: 15px; color: var(--text); font-weight: 600; }
.anom-km { font-size: 12px; color: var(--muted); margin-top: 2px; }
.anom-right { text-align: right; }
.anom-amt { font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--red); }
.anom-pct { font-size: 12px; color: var(--muted); }

/* 周走势产品切换按钮 */
.wk-toggle { margin-left: 12px; display: inline-flex; gap: 6px; }
.wk-btn { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); border-radius: 14px; padding: 4px 12px; font-size: 12px; cursor: pointer; }
.wk-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
/* 型号库存与覆盖明细 */
.sc-block { margin-bottom: 18px; }
.sc-block:last-child { margin-bottom: 0; }
.sc-prod { font-size: 14px; font-weight: 700; color: var(--text); padding: 8px 4px; }
.sc-prod em { font-style: normal; font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 6px; }
.sc-row { display: grid; grid-template-columns: 1.8fr 1.1fr 1.1fr 1fr .9fr; gap: 10px; align-items: center; padding: 9px 8px; border-bottom: 1px solid var(--line); font-size: 13px; }
.sc-row:last-child { border-bottom: none; }
.sc-head { color: var(--muted); font-size: 12px; }
.sc-head .r, .sc-num { text-align: right; }
.sc-sku { font-weight: 600; color: var(--text); font-size: 12px; }
.sc-num { font-family: var(--num); color: var(--text-2); }
.sc-num.ok b { color: var(--green); } .sc-num.warn b { color: var(--orange); } .sc-num.bad b { color: var(--red); }
/* 长线库存明细 · 上周 vs 本周 */
.lc-block { margin-bottom: 18px; }
.lc-block:last-child { margin-bottom: 0; }
.lc-prod { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 6px; }
.lc-prod-name { font-size: 14px; font-weight: 700; color: var(--text); }
.lc-prod-name em { font-style: normal; font-size: 12px; color: var(--muted); font-weight: 400; }
.lc-prod-sum { font-size: 12px; color: var(--text-2); font-family: var(--num); }
.lc-prod-sum b { color: var(--text); font-weight: 700; }
.lc-row { display: grid; grid-template-columns: 1.6fr 1fr 1.1fr .85fr 1fr 1fr; gap: 9px; align-items: center; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 13px; }
.lc-prod-right { display: inline-flex; align-items: center; gap: 12px; }
.lc-spark { width: 96px; height: 26px; display: inline-block; }
.lc-spark svg { width: 100%; height: 100%; display: block; }
.lc-row:last-child { border-bottom: none; }
.lc-head { color: var(--muted); font-size: 12px; }
.lc-head .r, .lc-num { text-align: right; }
.lc-sku { font-weight: 600; color: var(--text); font-size: 12px; }
.lc-num { font-family: var(--num); color: var(--text-2); }
.lc-num.ok b { color: var(--green); } .lc-num.bad b { color: var(--red); } .lc-num.muted b { color: var(--muted); }
.lc-cur { color: var(--text); font-weight: 600; }
.lc-in { color: var(--teal); } .lc-out { color: var(--accent); }
.lc-up { color: var(--green); } .lc-dn { color: var(--red); }
/* 进销周走势 · 按周产销数据对比 */
.wk-compare { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.wk-compare-head { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.wk-compare-head b { color: var(--accent); }
.wk-compare-hint { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 10px; }
.wc-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.4fr; gap: 10px; align-items: center; padding: 11px 8px; border-bottom: 1px solid var(--line); font-size: 13px; }
.wc-row:last-child { border-bottom: none; }
.wc-head { color: var(--muted); font-size: 12px; }
.wc-name { font-weight: 600; color: var(--text); }
.wc-num { font-family: var(--num); color: var(--text-2); }
.wc-num em { font-style: normal; font-size: 11px; color: var(--muted); margin-left: 1px; }
.wc-num b { font-weight: 700; }
.wc-num.ok b { color: var(--green); } .wc-num.bad b { color: var(--red); } .wc-num.muted b { color: var(--muted); }
.wk-export { float: right; background: var(--panel); color: var(--text-2); border: 1px solid var(--line); border-radius: 8px; padding: 5px 12px; font-size: 12px; cursor: pointer; transition: border-color .15s, background .15s; }
.wk-export:hover { border-color: #d4dae3; background: var(--panel-2); }
/* 周走势底部 6 项汇总 */
.wk-stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-top: 18px; }
.ws-card { display: flex; align-items: center; gap: 11px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; min-width: 0; }
.ws-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex-shrink: 0; }
.ws-ic svg { width: 19px; height: 19px; }
.ws-ic.g { background: rgba(34,171,108,.12); color: var(--green); }
.ws-ic.b { background: #eef2ff; color: var(--accent); }
.ws-ic.o { background: rgba(255,140,66,.13); color: #ff8c42; }
.ws-ic.r { background: rgba(239,68,68,.12); color: var(--red); }
.ws-ic.p { background: rgba(139,92,246,.12); color: var(--purple); }
.ws-body { min-width: 0; }
.ws-l { font-size: 12px; color: var(--muted); }
.ws-v { font-size: 19px; font-weight: 700; font-family: var(--num); color: var(--text); line-height: 1.2; }
.ws-u { font-size: 11px; color: var(--muted); font-weight: 600; font-family: -apple-system, "PingFang SC", sans-serif; }
.ws-d { font-size: 11px; display: block; margin-top: 1px; }
.ws-d.ok { color: var(--green); } .ws-d.bad { color: var(--red); } .ws-d.muted { color: var(--muted); }
@media (max-width: 1100px) { .wk-stats { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .wk-stats { grid-template-columns: 1fr 1fr; } }

/* 周报离屏画布 */
.report-sheet { position: fixed; left: -10000px; top: 0; width: 794px; background: #fff; color: #1f2733; padding: 36px 40px; font-family: Arial, "PingFang SC", sans-serif; box-sizing: border-box; }
.report-sheet.rendering { }
.report-sheet .rp-head { border-bottom: 3px solid #1F4E78; padding-bottom: 10px; margin-bottom: 14px; }
.report-sheet .rp-t { font-size: 24px; font-weight: 700; color: #1F4E78; }
.report-sheet .rp-sub { font-size: 12px; color: #666; margin-top: 4px; }
.report-sheet .rp-alert { background: #fdecea; border: 1px solid #e74c3c; color: #c0392b; padding: 10px 14px; border-radius: 6px; font-size: 13px; font-weight: 700; margin-bottom: 14px; }
.report-sheet .rp-sec { font-size: 15px; font-weight: 700; color: #1F4E78; margin: 18px 0 8px; border-left: 4px solid #1F4E78; padding-left: 8px; }
.report-sheet .rp-kpi { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.report-sheet .rp-kc { border: 1px solid #dde3ea; border-radius: 6px; padding: 8px; text-align: center; }
.report-sheet .rp-kl { font-size: 11px; color: #888; }
.report-sheet .rp-kv { font-size: 17px; font-weight: 700; color: #1f2733; margin-top: 3px; }
.report-sheet .rp-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.report-sheet .rp-tbl th { background: #1F4E78; color: #fff; padding: 6px 8px; text-align: left; }
.report-sheet .rp-tbl td { padding: 6px 8px; border-bottom: 1px solid #e6ebf1; }
.report-sheet .rp-tbl tr:nth-child(even) td { background: #F7F9FC; }
.report-sheet .rp-foot { margin-top: 20px; text-align: center; color: #999; font-size: 11px; border-top: 1px solid #e6ebf1; padding-top: 10px; }

/* 仓库资金占用 */
.wc-grid { display: grid; grid-template-columns: 1fr 1.4fr 1.2fr; gap: 24px; align-items: start; }
.wc-title { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.wc-big { font-size: 28px; font-weight: 700; font-family: var(--mono); color: var(--text); }
.wc-big.bad { color: var(--red); }
.wc-big .u { font-size: 13px; color: var(--muted); margin-left: 4px; }
.wc-sub2 { font-size: 13px; color: var(--muted); margin-top: 16px; }
.wc-note { font-size: 12px; color: var(--muted); margin-top: 6px; }
.wc-fin { font-size: 13px; color: var(--text); padding: 7px 0; border-bottom: 1px solid var(--line); }
.wc-fin .dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* 原材料预警 */
.content:has(> #page-mat:not(.hidden)) {
    max-width: none;
    padding-left: 16px;
    padding-right: 16px;
}
#page-mat {
    --mat-min: 1860px;
    --mat-cell-font: clamp(10.3px, .58vw, 11.8px);
}
#page-mat .mat-wide-row { margin-top: 14px; }
#page-mat .mat-card { padding: 14px; overflow: hidden; }
#page-mat #matToolbar[hidden],
#page-mat #matKpi[hidden] { display: none !important; }
#page-mat .mat-wide-row { margin-top: 0; }
#page-mat .chart-card.mat-card {
    padding: 0;
    border: 0;
    box-shadow: none;
    background: transparent;
    overflow: visible;
    min-width: 0;
    width: 100%;
    max-width: 100%;
}
#page-mat .mat-wide-row,
#page-mat #matTbl { min-width: 0; width: 100%; max-width: 100%; }
#page-mat .mat-toolbar { margin: 0 0 12px; }
.mat-filter-card {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}
.mat-filter-head {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.mat-filter-head b { color: var(--text); }
.mat-filter-head span { color: var(--muted); font-size: 12px; }
.mat-filterline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.mat-filter-seg { max-width: 100%; overflow-x: auto; }
.mat-search {
    min-width: 260px;
    flex: 1;
    max-width: 460px;
    height: 34px;
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: 10px;
    padding: 0 12px;
    color: var(--text);
}
.mat-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(66,99,235,.12); }
.mat-check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.mat-source { color: var(--muted); font-size: 12px; padding: 0 2px 10px; }
.mat-quick-add {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto;
    gap: 10px 12px;
    align-items: stretch;
    padding: 12px;
    margin: 0 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
}
.mat-quick-actions { display: flex; align-items: stretch; gap: 8px; }
.mat-quick-actions .top-btn,
.mat-quick-actions .btn-pri { white-space: nowrap; }
.mat-quick-actions .top-btn.danger { color: var(--red); border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.06); }
.mat-quick-actions .top-btn.danger:hover { color: #fff; border-color: var(--red); background: var(--red); }
.mat-quick-head { grid-column: 1 / -1; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.mat-quick-head b { color: var(--text); }
.mat-quick-head span { color: var(--muted); font-size: 12px; }
.mat-quick-add textarea {
    min-height: 48px;
    resize: vertical;
    border: 1px solid var(--line);
    border-radius: 9px;
    padding: 9px 10px;
    color: var(--text);
    background: #fff;
    font-family: var(--mono);
}
.mat-sheet { overflow: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.mat-head,
.mat-row {
    display: grid;
    grid-template-columns: 70px 126px 150px 150px 120px 72px 100px 98px 88px 90px 98px 128px 84px 80px 104px 76px minmax(130px,1fr) 116px;
    min-width: var(--mat-min);
    align-items: center;
    column-gap: 8px;
}
.mat-head {
    position: sticky;
    top: 0;
    z-index: 20;
    min-height: 48px;
    padding: 0 10px;
    background: #f7f9fc;
    border-bottom: 1px solid var(--line);
    color: #728099;
    font-size: 12px;
    font-weight: 700;
}
.mat-body { max-height: calc(100vh - 365px); min-height: 430px; overflow: visible; }
.mat-row {
    min-height: 50px;
    padding: 7px 10px;
    border-bottom: 1px solid var(--line);
    color: var(--text);
    font-size: 13px;
}
.mat-row:nth-child(even) { background: #fff; }
.mat-row:hover { background: #fff; }
.mat-row.mat-告警 { background: #fff; }
.mat-row.mat-在途补充中 { background: #fff; }
.mat-row.mat-停用 { opacity: .58; }

/* 默认精简列：8~9 列，列宽匀开（minmax(0,fr) 等比收放），不用横向滚动 */
.mat-compact .mat-head,
.mat-compact .mat-row {
    grid-template-columns: minmax(0,2.4fr) minmax(0,0.85fr) minmax(0,1.6fr) minmax(0,1.05fr) minmax(0,1fr) minmax(0,1.05fr) minmax(0,0.95fr) minmax(0,1fr) minmax(0,1.5fr) auto;
    min-width: 0;
    column-gap: 16px;
}
.mat-compact .mat-row { min-height: 56px; }
.mat-ident { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mat-ident b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-ident .mono { color: #6a7789; font-size: 11.5px; }
.mat-ident .tag { margin: 0; align-self: flex-start; }

/* 完整模式 = 真表格：列宽由内容自然撑开，外层横向滚动，避免固定宽造成空白或省略 */
#page-mat .mat-sheet.mat-full {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    max-height: calc(100vh - 178px);
    overflow: auto;
    position: relative;
}
table.mat-xtbl {
    width: max-content;
    max-width: none;
    min-width: 100%;
    table-layout: auto;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--mat-cell-font);
    line-height: 1.25;
    color: var(--text);
    background: var(--panel);
}
@media (min-width: 1900px) {
    #page-mat { --mat-cell-font: 12px; }
}
@media (max-width: 1320px) {
    #page-mat { --mat-cell-font: 10.2px; }
    .mat-quick-add { grid-template-columns: 1fr; }
    .mat-quick-actions { justify-content: flex-start; }
}
/* 关键：<tr> 仍带 .mat-row 类(供 JS/状态色用)，必须强制回正常表格显示，别套用 compact 的 display:grid（否则单元格重叠错位） */
.mat-xtbl tr.mat-row { display: table-row; grid-template-columns: none; column-gap: 0; min-width: 0; height: 34px; }
.mat-xtbl td, .mat-xtbl th { display: table-cell; }
/* 预警主表整行拖拽：行可抓取拖动排序，单元格编辑/下拉/按钮交互不受影响 */
.mat-xtbl tr.mat-drag-row { cursor: grab; }
.mat-xtbl tr.mat-drag-row:active { cursor: grabbing; }
.mat-xtbl tr.mat-drag-row.is-dragging,
.mat-xtbl tr.mat-drag-row.is-dragging td { opacity: .55; background: #eef2ff; }
.mat-xtbl tr.mat-drag-row.is-dragging-source td { opacity: .32; }
.mat-sheet.is-row-dragging,
.mat-sheet.is-row-dragging * { cursor: grabbing; user-select: none; }
.mat-drag-ghost-table {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    border-collapse: separate;
    border-spacing: 0;
    box-shadow: 0 12px 24px rgba(15, 23, 42, .16);
    opacity: .96;
    transform: translateZ(0);
    will-change: transform;
    contain: paint;
}
.mat-drag-ghost-table tr,
.mat-drag-ghost-table td {
    background: #fff !important;
}
.mat-drag-ghost-table td {
    overflow: hidden;
    text-overflow: ellipsis;
}
.mat-drop-line {
    position: fixed;
    z-index: 9998;
    height: 3px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 2px rgba(66, 99, 235, .12), 0 4px 12px rgba(66, 99, 235, .28);
    pointer-events: none;
}
.mat-drop-line::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--accent);
    transform: translate(-2px, -50%);
}
.mat-xtbl tr.mat-drag-row .mat-editable { cursor: text; }
.mat-xtbl tr.mat-drag-row .mat-st-pick,
.mat-xtbl tr.mat-drag-row button,
.mat-xtbl tr.mat-drag-row .switch { cursor: pointer; }
.mat-xtbl th, .mat-xtbl td {
    max-width: none;
    height: 34px;
    border: 1px solid var(--line);
    padding: 4px 6px;
    white-space: nowrap;
    vertical-align: middle;
    text-align: left;
    overflow: visible;
    text-overflow: clip;
}
/* 状态=单个下拉/标签，颜色随状态；像 Excel 的单格状态 */
.mat-st-pick { appearance: auto; width: 100%; max-width: 100%; min-width: 0; height: 24px; font-size: 11px; line-height: 1.1; padding: 1px 4px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--text-2, #475569); cursor: pointer; }
.mat-st-pick:focus { outline: none; box-shadow: 0 0 0 3px rgba(66,99,235,.12); }
.mat-st-tag { display: inline-block; font-size: 11.5px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.mat-st-pick.st-danger, .mat-st-tag.st-danger { background: var(--st-danger-bg); color: var(--st-danger-fg); border-color: rgba(239,68,68,.4); }
.mat-st-pick.st-warn, .mat-st-tag.st-warn { background: var(--st-warn-bg); color: var(--st-warn-fg); border-color: rgba(245,166,35,.4); }
.mat-st-pick.st-ok, .mat-st-tag.st-ok { background: var(--st-ok-bg); color: var(--st-ok-fg); border-color: rgba(34,171,108,.4); }
.mat-st-pick.st-neutral, .mat-st-tag.st-neutral { background: var(--st-neutral-bg); color: var(--st-neutral-fg); }
.mat-st-pick.st-buy, .mat-st-tag.st-buy { background: var(--st-info-bg); color: var(--st-info-fg); border-color: rgba(66,99,235,.4); }
.mat-st-pick.st-call, .mat-st-tag.st-call { background: var(--st-purple-bg); color: var(--st-purple-fg); border-color: rgba(139,92,246,.4); }
.mat-xtbl thead th { position: sticky; top: 0; z-index: 5; height: 34px; background: #f7f9fc; color: #728099; font-weight: 700; }
.mat-xtbl td.r, .mat-xtbl th.r { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.mat-xtbl td.mono { font-family: var(--mono); color: #66758b; }
.mat-xtbl .mat-remain,
.mat-compact .mat-remain {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 22px;
    padding: 0 8px;
    border-radius: 999px;
    font-family: var(--mono);
    font-weight: 700;
    line-height: 1;
    color: #475569;
    background: transparent;
}
.mat-xtbl .mat-remain-5,
.mat-compact .mat-remain-5 { color: #8a5a00; background: #fff4c2; box-shadow: inset 0 0 0 1px rgba(245,166,35,.28); }
.mat-xtbl .mat-remain-3,
.mat-compact .mat-remain-3 { color: #9a3412; background: #fed7aa; box-shadow: inset 0 0 0 1px rgba(245,166,35,.36); }
.mat-xtbl .mat-remain-1,
.mat-compact .mat-remain-1 { color: #991b1b; background: #fecaca; box-shadow: inset 0 0 0 1px rgba(239,68,68,.34); }
.mat-water {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 72px;
    vertical-align: middle;
    white-space: nowrap;
}
.mat-water i {
    display: block;
    width: 0;
    max-width: 44px;
    height: 6px;
    border-radius: 999px;
    background: var(--green);
    box-shadow: inset 0 0 0 1px rgba(0,0,0,.04);
}
.mat-water b {
    font-family: var(--mono);
    font-size: 11.5px;
    font-weight: 700;
    color: #344054;
    line-height: 1;
}
.mat-water-low i { background: var(--red); }
.mat-water-warn i { background: var(--orange); }
.mat-water-unset {
    min-width: 42px;
    color: #94a3b8;
    font-size: 12px;
}
.mat-water-unset i { display: none; }
.mat-water-unset b { display: none; }
.mat-xtbl tbody tr:hover td { background: #fbfcff; }
.mat-xtbl tbody tr.mat-remain-row-5:not(.is-dragging) td,
.mat-xtbl tbody tr.mat-remain-row-5:not(.is-dragging):hover td { background: #fff8db; }
.mat-xtbl tbody tr.mat-remain-row-3:not(.is-dragging) td,
.mat-xtbl tbody tr.mat-remain-row-3:not(.is-dragging):hover td { background: #ffedd5; }
.mat-xtbl tbody tr.mat-remain-row-1:not(.is-dragging) td,
.mat-xtbl tbody tr.mat-remain-row-1:not(.is-dragging):hover td { background: #fee2e2; }
.mat-compact .mat-row.mat-remain-row-5 { background: #fff8db; }
.mat-compact .mat-row.mat-remain-row-3 { background: #ffedd5; }
.mat-compact .mat-row.mat-remain-row-1 { background: #fee2e2; }
.mat-xtbl tbody tr.mat-停用 { opacity: .58; }
.mat-xtbl td b { display: inline-block; max-width: none; overflow: visible; text-overflow: clip; vertical-align: bottom; font-weight: 700; }
.mat-xtbl td.mat-editable { cursor: text; text-decoration: underline dotted rgba(66,99,235,.4); text-underline-offset: 3px; }
.mat-xtbl td.mat-editable:hover, .mat-xtbl td.mat-editable:focus { background: #eef2ff; text-decoration: none; outline: none; }
.mat-xtbl td.mat-editable.is-editing { background: #fff; box-shadow: inset 0 0 0 2px #64748b; }
.mat-xtbl td.ops { text-align: center; }
.mat-xtbl .mat-group-edit { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,.9fr); gap: 4px; }
.mat-xtbl .mat-group-edit .mat-editable { display: inline-flex; min-width: max-content; overflow: visible; text-overflow: clip; }
.mat-xtbl .mat-actions { display: inline-flex; align-items: center; justify-content: center; gap: 3px; width: 100%; }
.mat-xtbl .tag { margin: 0 0 0 6px; }
.mat-xtbl .ibtn { width: 24px; height: 24px; min-width: 24px; border-radius: 7px; font-size: 11px; }
.mat-xtbl .switch { width: 30px; min-width: 30px; height: 17px; border-radius: 999px; }
.mat-xtbl .switch::after { width: 13px; height: 13px; top: 1px; left: 2px; }
.mat-xtbl .switch.on::after { transform: translateX(13px); }
#page-mat .mat-full .mat-xtbl th:nth-child(1),
#page-mat .mat-full .mat-xtbl td:nth-child(1) {
    left: var(--mat-freeze-left-1, 0px);
}
#page-mat .mat-full .mat-xtbl th:nth-child(2),
#page-mat .mat-full .mat-xtbl td:nth-child(2) {
    left: var(--mat-freeze-left-2, 0px);
}
#page-mat .mat-full .mat-xtbl th:nth-child(3),
#page-mat .mat-full .mat-xtbl td:nth-child(3) {
    left: var(--mat-freeze-left-3, 0px);
}
#page-mat .mat-full .mat-xtbl th:nth-child(4),
#page-mat .mat-full .mat-xtbl td:nth-child(4) {
    left: var(--mat-freeze-left-4, 0px);
    box-shadow: 8px 0 14px -14px rgba(16, 24, 40, .32);
}
#page-mat .mat-full .mat-xtbl th:nth-child(-n+4),
#page-mat .mat-full .mat-xtbl td:nth-child(-n+4) {
    position: sticky;
    z-index: 7;
    background: #fff;
    background-clip: padding-box;
    overflow: hidden;
    text-overflow: ellipsis;
}
#page-mat .mat-full .mat-xtbl thead th:nth-child(-n+4) {
    z-index: 12;
    background: #f7f9fc;
}
#page-mat .mat-full .mat-xtbl tbody tr:hover td:nth-child(-n+4) { background: #fbfcff; }
#page-mat .mat-full .mat-xtbl tbody tr.mat-remain-row-5:not(.is-dragging) td:nth-child(-n+4),
#page-mat .mat-full .mat-xtbl tbody tr.mat-remain-row-5:not(.is-dragging):hover td:nth-child(-n+4) { background: #fff8db; }
#page-mat .mat-full .mat-xtbl tbody tr.mat-remain-row-3:not(.is-dragging) td:nth-child(-n+4),
#page-mat .mat-full .mat-xtbl tbody tr.mat-remain-row-3:not(.is-dragging):hover td:nth-child(-n+4) { background: #ffedd5; }
#page-mat .mat-full .mat-xtbl tbody tr.mat-remain-row-1:not(.is-dragging) td:nth-child(-n+4),
#page-mat .mat-full .mat-xtbl tbody tr.mat-remain-row-1:not(.is-dragging):hover td:nth-child(-n+4) { background: #fee2e2; }
#page-mat .mat-full .mat-xtbl tr.mat-drag-row.is-dragging td:nth-child(-n+4) { background: #eef2ff; }
.mat-row .r, .mat-head .r { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.mat-row .mono { font-family: var(--mono); color: #66758b; }
.mat-row b { font-weight: 700; }
.mat-row .tag { margin-left: 6px; }
.mat-row .tag:first-child { margin-left: 0; }
.mat-symbol { font-family: var(--mono); font-size: 13px; line-height: 1; }
.mat-row .bad { color: var(--red); font-weight: 700; }
.mat-row .warn { color: #a16505; font-weight: 700; }
.mat-remark { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mat-editable {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    min-width: 0;
    padding: 5px 7px;
    margin: -5px -7px;
    border-radius: 7px;
    cursor: text;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: rgba(66,99,235,.35);
    text-underline-offset: 3px;
    transition: background .12s var(--ease-out, ease), box-shadow .12s var(--ease-out, ease), text-decoration-color .12s var(--ease-out, ease);
}
.mat-auto {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    min-width: 0;
    padding: 5px 7px;
    margin: -5px -7px;
    border-radius: 7px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    background: transparent;
    box-shadow: none;
}
.mat-auto.r { justify-content: flex-end; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.mat-editable.r { justify-content: flex-end; text-align: right; }
.mat-editable:hover, .mat-editable:focus {
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(148,163,184,.55);
    text-decoration-color: transparent;
    outline: none;
}
.mat-editable.is-editing {
    background: #fff;
    box-shadow: inset 0 0 0 2px #64748b, 0 6px 18px -14px rgba(15,23,42,.35);
}
.mat-editable.is-saving { opacity: .62; }
.mat-cell-input {
    width: auto;
    min-width: 8ch;
    height: 28px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-family: inherit;
}
.mat-editable.r .mat-cell-input { text-align: right; font-family: var(--mono); }
.mat-input-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    max-width: none;
    white-space: nowrap;
}
.mat-input-unit {
    flex: 0 0 auto;
    color: var(--text);
    font-family: var(--mono);
}
.mat-group-edit { display: grid; grid-template-columns: 1fr 46px; gap: 6px; min-width: 0; }
.mat-group-edit .mat-editable { margin: 0; padding: 3px 5px; min-height: 26px; }
.mat-empty { color: #a4afbf; }
.mat-draft {
    background: #fff !important;
}
.mat-draft .mat-editable {
    box-shadow: inset 0 0 0 1px rgba(148,163,184,.35);
}
.mat-actions { display: inline-flex; align-items: center; gap: 8px; }
.mat-op { text-align: center; }
.mat-modal-back {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, .18);
}
.mat-modal {
    width: min(820px, 94vw);
    max-height: min(760px, 90vh);
    overflow: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 24px 70px -32px rgba(16, 24, 40, .44);
}
.mo-pop { animation: mo-pop 160ms var(--ease-out, ease) both; }
.mat-modal-head, .mat-modal-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}
.mat-modal-foot { border-top: 1px solid var(--line); border-bottom: 0; justify-content: flex-end; }
.mat-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 16px;
}
.mat-form label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.mat-form input, .mat-form select, .mat-form textarea, .mat-bulk {
    border: 1px solid var(--line);
    background: var(--panel-2);
    border-radius: 8px;
    padding: 8px 10px;
    color: var(--text);
    font: inherit;
}
.mat-form textarea { min-height: 72px; resize: vertical; }
.mat-form .wide { grid-column: span 2; }
.mat-inline { display: inline-flex !important; grid-template-columns: auto 1fr !important; align-items: center; }
.mat-bulk {
    width: calc(100% - 32px);
    min-height: 260px;
    margin: 16px;
    resize: vertical;
    font-family: var(--mono);
    line-height: 1.6;
}
.mat-meta-panel { width: min(1180px, 96vw); }
.mat-modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; font-weight: 400; }
.mat-meta-top {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
}
.mat-meta-body { padding: 0 16px 16px; }
.mat-meta-grid { min-width: 720px; overflow: auto; }
.mat-meta-headrow,
.mat-meta-row {
    display: grid;
    grid-template-columns: var(--meta-cols) 88px;
    gap: 10px;
    align-items: center;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
}
.mat-meta-headrow {
    position: sticky;
    top: 0;
    background: #f7f9fc;
    color: #728099;
    font-weight: 700;
    font-size: 12px;
    z-index: 1;
}
.mat-meta-row { font-size: 12.5px; color: var(--text); }
.mat-meta-row:nth-child(even) { background: #fafbfe; }
.mat-meta-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 用户管理 / 上传日志 */
.user-list, .log-list { margin: 10px 0; font-size: 14px; }
.ul-head, .ul-row { display: grid; grid-template-columns: 1.7fr 1.5fr .9fr 120px; padding: 9px 4px; align-items: center; }   /* 操作列收窄=3×.ibtn 宽，消除旧文字链留下的死白 */
.ul-head, .lg-head { color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); }
.ul-row { border-bottom: 1px solid var(--line); color: var(--text); }
/* .ul-act 现为 .ibtn 图标按钮(类名仅供 JS 委托)，旧文字链样式已废除 */
.user-new { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.user-new input, .user-new select { padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; color: var(--text); }
.user-new button { background: var(--accent); color: #fff; border: none; border-radius: 6px; padding: 9px 18px; cursor: pointer; }
.page-pick { margin-top: 12px; padding: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; }
.pp-item { display: inline-flex; align-items: center; gap: 6px; margin: 4px 16px 4px 0; font-size: 13px; color: var(--text); cursor: pointer; }
.pp-item input { cursor: pointer; }
.lg-head, .lg-row { display: grid; grid-template-columns: 1.4fr .9fr 1.4fr .7fr .9fr; padding: 8px 4px; align-items: center; }
.lg-row { border-bottom: 1px solid var(--line); color: var(--text); font-size: 13px; }
.lg-row .num { font-family: var(--mono); text-align: center; }
#pasteBox { width: 100%; margin: 10px 0; padding: 10px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; color: var(--text); font-family: var(--mono); font-size: 13px; resize: vertical; }

@media (max-width: 768px) {
    .bullet-wrap { grid-template-columns: 1fr; }
}
/* Stage3 响应式：图表高度小屏自适应(ECharts 靠 resize 重绘)；宽数据表(规格矩阵/原材料12列)窄屏横向滚动而非挤压 */
@media (max-width: 768px) {
    .chart-body { height: 260px; }
    .chart-body.tall { height: 320px; }
}
@media (max-width: 480px) {
    .chart-body { height: 220px; }
    .chart-body.tall { height: 270px; }
}
@media (max-width: 900px) {
    #specMatrix, #matTbl { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    #specMatrix .sm-head, #specMatrix .sm-row { min-width: 680px; }
    .mat-form { grid-template-columns: 1fr; }
    .mat-form .wide { grid-column: auto; }
}
.chart-empty {
    display: flex; align-items: center; justify-content: center; height: 100%;
    color: var(--muted); font-size: 14px;
}
/* 接口错误态 + 重试（别静默白屏）：dashErr 错误条 / loadError 占位 */
.load-error {
    display: flex; align-items: center; gap: 14px; justify-content: center; flex-wrap: wrap;
    background: #fff5f5; border: 1px solid #fbd5d5; border-radius: 12px;
    padding: 14px 18px; margin: 0 0 16px; color: var(--red); font-size: 14px;
}
.load-error .le-msg { font-weight: 600; }
.load-error .le-retry {
    border: 1px solid var(--red); background: #fff; color: var(--red);
    border-radius: 8px; padding: 6px 16px; font-size: 13px; font-weight: 600; cursor: pointer;
    transition: background var(--dur-fast, .12s) var(--ease-out, ease);
}
.load-error .le-retry:hover { background: var(--red); color: #fff; }
.empty-state {
    min-height: 128px; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; padding: 24px; text-align: center; color: var(--muted);
    background: linear-gradient(180deg, #fbfcff 0%, #f7f9fd 100%);
    border: 1px dashed #dfe6f0; border-radius: 14px;
}
.empty-state.compact { min-height: 92px; padding: 18px; }
.empty-state .es-mark {
    width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 12px; background: #eef3ff; color: var(--accent); font-weight: 800; font-family: var(--num);
}
.empty-state .es-title { color: var(--text); font-weight: 800; font-size: 15px; }
.empty-state .es-desc { max-width: 560px; line-height: 1.7; font-size: 13px; }

/* ---------- 上传页 ---------- */
.upload-wrap { padding: 28px; max-width: 900px; margin: 0 auto; }
.upload-card {
    background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
    padding: 22px; margin-bottom: 18px;
}
.upload-card h2 { font-size: 16px; margin-bottom: 8px; color: var(--text); }
.upload-card input[type=file] { color: var(--text); margin: 12px 0; }
.upload-card button {
    background: var(--accent); color: #fff; border: none; border-radius: 7px;
    padding: 9px 20px; font-size: 14px; cursor: pointer; margin-left: 8px;
}
.muted { color: var(--muted); font-size: 13px; }
.hidden { display: none; }
.preview-stats { display: flex; gap: 14px; flex-wrap: wrap; margin: 14px 0; }
.pv {
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
    padding: 12px 20px; text-align: center; min-width: 90px;
    color: var(--muted); font-size: 13px;
}
.pv span { display: block; font-size: 26px; font-weight: 700; color: var(--text); font-family: var(--num); }
.pv.ok span { color: var(--green); }
.pv.warn span { color: var(--orange); }
.pv.bad span { color: var(--red); }
.preview-problems { max-height: 240px; overflow-y: auto; margin: 8px 0; }
.prob-title { font-size: 13px; color: var(--orange); margin-bottom: 6px; }
.prob { font-size: 13px; color: var(--muted); padding: 3px 0; border-bottom: 1px dashed var(--line); }
.chg-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.chg-key { font-size: 13px; color: var(--text); margin-bottom: 4px; }
.chg-diff { display: inline-block; font-size: 12px; color: var(--muted); margin: 2px 14px 2px 0; background: rgba(243,156,18,.1); padding: 2px 8px; border-radius: 4px; }
.chg-diff b { color: var(--text); }
.chg-diff s { color: var(--red); }
.chg-diff em { color: var(--green); font-style: normal; font-weight: 700; }
.commit-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.commit-row select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; }

/* ---------- 全局质感精修 ---------- */
/* 自定义滚动条：细、淡、圆 */
* { scrollbar-width: thin; scrollbar-color: #d4dae3 transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4dae3; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #b9c2cf; }
/* 筛选条：输入聚焦光环 + 平滑 */
.filters select, .cn-date { transition: border-color .15s ease, box-shadow .15s ease; }
.filters select:hover, .cn-date:hover { border-color: #d4dae3; }
.filters select:focus, .cn-date:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(66, 99, 235, .12); }
.filters button { transition: background .15s ease, transform .1s ease; }
.filters button:not(.ghost):hover { background: #3552d4; }
.filters button.ghost:hover { border-color: #d4dae3; color: var(--text-2); }
.filters button:active { transform: translateY(1px); }
/* 链接平滑 */
.btn-link { transition: color .15s ease; }
/* 表格行 hover 高亮（统一交互反馈） */
.itbl-row, .tt-row, .st-row, .pd-row, .rt-row, .bal-row, .loss-row { transition: background .12s ease; }
.itbl-row:hover, .tt-row:hover, .st-row:hover, .bal-row:hover { background: #f6f8fc; }
/* 切页淡入：内容更柔和 */
.page:not(.hidden) { animation: jcFade .26s ease; }
@keyframes jcFade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- 响应式：窄屏适配（新版侧栏外壳） ---------- */
@media (max-width: 1100px) {
    .content { padding: 22px 20px 32px; }
    .chart-row { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .sidebar { width: 76px; flex-basis: 76px; }
    .side-logo { width: 46px; height: 46px; border-radius: 15px; }
    .sidebar .tab { width: 66px; height: 70px; font-size: 0; gap: 0; }      /* 窄屏只留色块图标 */
    .sidebar .tab svg { width: 25px; height: 25px; padding: 13px; border-radius: 18px; }
    .sidebar .tab span { display: none; }
    .topbar { padding: 0 16px; height: 56px; }
    .filters { padding: 12px 16px; }
    .content { padding: 18px 14px 28px; }
    .row-count { margin-left: 0; width: 100%; }
}

/* ============ 轻玻璃外壳 + 克制动效（体验升级 v8）============ */
/* 红线：仅外壳玻璃化（侧栏/顶栏/筛选条）；图表/表格/KPI数字/卡片主体/打印页 一律不动 */
:root {
    --glass-bg: rgba(255, 255, 255, .70);
    --glass-blur: saturate(165%) blur(13px);
    --glass-line: rgba(16, 24, 40, .06);
}
@supports ((backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px))) {
    .sidebar, .topbar, .filters {
        background: var(--glass-bg);
        -webkit-backdrop-filter: var(--glass-blur);
        backdrop-filter: var(--glass-blur);
    }
    .topbar { border-bottom-color: var(--glass-line); }
    .sidebar { border-right-color: var(--glass-line); }
    .filters { border-bottom-color: var(--glass-line); }
}
/* 按钮轻按压（150ms 内，克制） */
.top-btn:active, .filters button:active, .btn-export:active, .wk-export:active, .cn-date:active { transform: translateY(1px) scale(.992); }
/* 尊重系统「减少动效」：一律近乎关闭，低配/晕动友好，不影响功能 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============ 交互/动效 Pass（v9）：统一 motion token + 焦点 + 按压 + 透明度降级 ============ */
/* motion token：统一缓动与时长，扩展现有 transition、不另起一套 */
:root {
    --ease-out: cubic-bezier(.22, .61, .36, 1);   /* 进入：先快后缓 */
    --ease-soft: cubic-bezier(.4, 0, .2, 1);       /* 通用柔和 */
    --dur-fast: 90ms;    /* 按压/小反馈 */
    --dur-mid: 180ms;    /* 切页/弹窗/hover */
    --dur-slow: 240ms;   /* Toast/较大浮层 */
}
/* 统一可见焦点环：键盘可达，不影响鼠标点击外观（克制、不抖布局） */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 6px;
}
/* 统一按钮按压（补充现有 :active 规则；克制 1px，不影响有专属 :active 的元素） */
button:active:not(:disabled) { transform: translateY(1px) scale(.992); }
/* 降级：系统开启「减少透明度」→ 玻璃壳变实底（验收6） */
@media (prefers-reduced-transparency: reduce) {
    :root { --glass-bg: rgba(255, 255, 255, .98); --glass-blur: none; }
    .sidebar, .topbar, .filters {
        background: rgba(255, 255, 255, .98) !important;
        -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    }
}

/* 页面「正在更新」轻反馈：fixed 浮层不顶布局；切换/刷新时短暂出现，旧内容保留 */
.inv-updating, .sys-updating {
    position: fixed; top: 64px; left: 50%;
    transform: translateX(-50%) translateY(-6px);
    background: var(--glass-bg, rgba(255, 255, 255, .9)); color: var(--text-2);
    border: 0.5px solid var(--glass-line, rgba(16, 24, 40, .06));
    border-radius: 999px; padding: 7px 16px; font-size: 12.5px; font-weight: 600;
    box-shadow: 0 8px 24px -12px rgba(16, 24, 40, .25);
    opacity: 0; pointer-events: none; z-index: 60;
    transition: opacity var(--dur-mid, 180ms) var(--ease-out, ease), transform var(--dur-mid, 180ms) var(--ease-out, ease);
}
.inv-updating::before, .sys-updating::before {
    content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 7px;
    border: 2px solid var(--muted); border-top-color: var(--accent); border-radius: 50%;
    vertical-align: -1px; animation: invspin .7s linear infinite;
}
.inv-updating.show, .sys-updating.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@keyframes invspin { to { transform: rotate(360deg); } }
@supports ((backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px))) {
    .inv-updating, .sys-updating { -webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px); }
}
@media (prefers-reduced-transparency: reduce) {
    .inv-updating, .sys-updating { background: #fff; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-reduced-motion: reduce) {
    .inv-updating::before, .sys-updating::before { animation: none; border-top-color: var(--muted); }
}
