dsh-data-dashboard 0.0.0-stage → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/README.md +35 -2
  2. package/assets/theater-board.svg +1 -0
  3. package/backend/incremental/flow.mjs +492 -0
  4. package/backend/incremental/jobs.mjs +58 -0
  5. package/backend/incremental/xlsx-rows.mjs +145 -0
  6. package/backend/job-worker.mjs +22 -0
  7. package/backend/modules/banquet/index.mjs +46 -0
  8. package/backend/modules/inventory/index.mjs +45 -0
  9. package/backend/modules/inventory/legacy-fields.mjs +83 -0
  10. package/backend/modules/invoice/index.mjs +72 -0
  11. package/backend/modules/movement/index.mjs +68 -0
  12. package/backend/modules/opening/index.mjs +48 -0
  13. package/backend/modules/target/index.mjs +45 -0
  14. package/backend/modules/terminal/index.mjs +114 -0
  15. package/backend/modules.mjs +12 -0
  16. package/backend/public/admin.css +192 -0
  17. package/backend/public/admin.js +713 -0
  18. package/backend/public/board.css +43 -0
  19. package/backend/public/board.html +47 -0
  20. package/backend/public/board.js +96 -0
  21. package/backend/public/index.html +110 -0
  22. package/backend/public/review.css +5 -0
  23. package/backend/public/review.js +452 -0
  24. package/backend/real-data/generate-dashboard.mjs +135 -0
  25. package/backend/real-data/inventory-history.mjs +316 -0
  26. package/backend/real-data/organization-mapping.mjs +102 -0
  27. package/backend/real-data/source-payload.mjs +459 -0
  28. package/backend/real-data/terminal-components.mjs +280 -0
  29. package/backend/real-data/terminal-structure.css +105 -0
  30. package/backend/real-data/terminal-structure.mjs +276 -0
  31. package/backend/real-data/v10-components.mjs +112 -0
  32. package/backend/real-data/v10-details.css +18 -0
  33. package/backend/real-data/v10-details.mjs +251 -0
  34. package/backend/real-data/v10-layout.css +27 -0
  35. package/backend/real-data/v10-model.mjs +521 -0
  36. package/backend/real-data/v10-overview-data.mjs +248 -0
  37. package/backend/real-data/v10-overview.css +264 -0
  38. package/backend/real-data/v10-overview.mjs +263 -0
  39. package/backend/real-data/v10-presentation.mjs +342 -0
  40. package/backend/real-data/v10-shell.html +1097 -0
  41. package/backend/real-data/v10-template.mjs +351 -0
  42. package/backend/recognition/fingerprint.mjs +32 -0
  43. package/backend/recognition/headers.mjs +2 -0
  44. package/backend/recognition/module-definition.mjs +4 -0
  45. package/backend/recognition/result.mjs +29 -0
  46. package/backend/recognition/upload-limits.mjs +14 -0
  47. package/backend/review-engine.mjs +364 -0
  48. package/backend/review-service.mjs +182 -0
  49. package/backend/server.mjs +545 -0
  50. package/backend/store.mjs +68 -0
  51. package/backend/target-template.mjs +47 -0
  52. package/backend/validate-workbook.mjs +251 -0
  53. package/backend/web-sync/README.md +37 -0
  54. package/backend/web-sync/client.mjs +63 -0
  55. package/backend/web-sync/exporter.mjs +260 -0
  56. package/backend/web-sync/local.html +34 -0
  57. package/backend/web-sync/server.mjs +147 -0
  58. package/build-manifest.json +79 -0
  59. package/client.js +24 -0
  60. package/cordis.patch.yml +3 -0
  61. package/index.js +117 -0
  62. package/lib/dist-manifest.mjs +19 -0
  63. package/lib/market-index.mjs +56 -0
  64. package/lib/package-audit.mjs +34 -0
  65. package/lib/settings.mjs +71 -0
  66. package/lib/tool-definitions.mjs +56 -0
  67. package/lib/tools.mjs +255 -0
  68. package/locale/en.json +6 -0
  69. package/locale/zh.json +6 -0
  70. package/package.json +71 -4
@@ -0,0 +1,248 @@
1
+ // Serialized into each offline dashboard. Keep this factory self-contained.
2
+ export function createV10OverviewData(model, presentation) {
3
+ const cache = new WeakMap(), regionalCache = new Map();
4
+ const finite = value => typeof value === 'number' && Number.isFinite(value);
5
+ const text = value => typeof value === 'string' && value.trim().length > 0;
6
+ // Pure per string; memoized because comparisons re-check every row's date.
7
+ const validDates = new Map();
8
+ const validDate = value => {
9
+ if (typeof value !== 'string') return false;
10
+ let result = validDates.get(value);
11
+ if (result === undefined) {
12
+ result = /^\d{4}-\d{2}-\d{2}$/.test(value) && Number.isFinite(Date.parse(`${value}T00:00:00Z`)) && new Date(`${value}T00:00:00Z`).toISOString().slice(0, 10) === value;
13
+ validDates.set(value, result);
14
+ }
15
+ return result;
16
+ };
17
+ const keyFor = filters => JSON.stringify([filters.month, filters.period, filters.start, filters.end, filters.region, filters.office, filters.unit, filters.product]);
18
+ const periodOf = filters => model.periodOf ? model.periodOf(filters) : { mode: 'month', start: `${filters.month}-01`, end: null, month: filters.month };
19
+ const pending = (label, unit, reason, state = 'pending') => ({ label, unit, value: null, state, reason });
20
+ const copy = item => ({ ...item, ...(item?.notes ? { notes: [...item.notes] } : {}), ...(item?.range ? { range: { ...item.range } } : {}) });
21
+ const ready = item => item?.state === 'available' && finite(item.value);
22
+ const partsFor = key => { try { const result = JSON.parse(key); return Array.isArray(result) ? result : []; } catch { return []; } };
23
+ const fullName = key => partsFor(key).map(value => text(value) ? value : '未提供').join(' / ') || '未提供组织';
24
+ const defaultFilters = filters => { const f = { ...model.defaults, ...filters }, p = periodOf(f); return p.mode === 'range' ? { ...f, month: p.month } : f; };
25
+ const childFilters = (filters, level, key) => ({ ...filters, [level]: key,
26
+ ...(level === 'region' ? { office: 'all', unit: 'all' } : level === 'office' ? { unit: 'all' } : {}) });
27
+ const monthEnd = month => new Date(Date.UTC(Number(month.slice(0, 4)), Number(month.slice(5, 7)), 0)).toISOString().slice(0, 10);
28
+ const priorDate = (date, fullMonthEnd = false) => {
29
+ const month = `${Number(date.slice(0, 4)) - 1}${date.slice(4, 7)}`, last = monthEnd(month);
30
+ return fullMonthEnd ? last : `${month}-${String(Math.min(Number(date.slice(8)), Number(last.slice(8)))).padStart(2, '0')}`;
31
+ };
32
+ const sum = values => {
33
+ let value = 0, correction = 0;
34
+ for (const item of values) { const next = item - correction, updated = value + next; correction = (updated - value) - next; value = updated; }
35
+ return value;
36
+ };
37
+ function windowMetric(id, module, start, end, requireMonths = false) {
38
+ const field = id === 'opening' ? 'bottles' : 'amount', unit = id === 'opening' ? '瓶' : '元';
39
+ const fail = (reason, state = 'missing') => ({ ...pending('同期来源合计', unit, reason, state), range: { start, end } });
40
+ const source = model.payload.modules[id], cover = model.payload.coverage[id];
41
+ if (source.state === 'unavailable') return fail('未接入有效来源');
42
+ if (!validDate(start) || !validDate(end) || start > end) return fail('比较期间无效');
43
+ if (!validDate(cover?.start) || !validDate(cover?.end) || cover.start > start || cover.end < end) return fail('来源未覆盖完整比较期间');
44
+ if (source.metrics?.[field]?.status === 'pending') return fail('来源数值口径待确认', 'pending');
45
+ const scoped = module.scopedRows || [];
46
+ if (scoped.some(row => !validDate(row.date))) return fail('存在缺失或无效日期,无法完整分期', 'pending');
47
+ const rows = scoped.filter(row => row.date >= start && row.date <= end);
48
+ if (!rows.length) return fail('当前范围缺少同期记录,不推定为零');
49
+ if (requireMonths) {
50
+ const months = new Set(rows.map(row => row.date.slice(0, 7)));
51
+ for (let date = `${start.slice(0, 7)}-01`; date <= end; date = new Date(Date.UTC(Number(date.slice(0, 4)), Number(date.slice(5, 7)), 1)).toISOString().slice(0, 10)) {
52
+ if (!months.has(date.slice(0, 7))) return fail('累计比较期间缺月,不能补零');
53
+ }
54
+ }
55
+ if (rows.some(row => !finite(row[field]))) return fail('比较期间存在缺失或不可用数值', 'pending');
56
+ const value = sum(rows.map(row => row[field]));
57
+ if (!finite(value)) return fail('来源合计超出可表示范围', 'pending');
58
+ return { label: '同期来源合计', unit, value, state: 'available', reason: null, range: { start, end },
59
+ negative: id === 'opening' ? null : sum(rows.filter(row => row.amount < 0).map(row => row.amount)) };
60
+ }
61
+ function yearComparison(id, module, filters, cumulative = false, fixedRange = null) {
62
+ const p = periodOf(filters), range = p.mode === 'range';
63
+ const label = cumulative ? '累计同比' : range ? '区间同比' : '当月同比', cover = model.payload.coverage[id];
64
+ const month = range ? p.month : filters.month, validMonth = /^\d{4}-(0[1-9]|1[0-2])$/.test(month || '');
65
+ const start = fixedRange?.start || (validMonth ? cumulative ? `${month.slice(0, 4)}-01-01` : range ? p.start : `${month}-01` : null);
66
+ const end = fixedRange?.end || (validMonth && validDate(cover?.end) ? [range ? p.end : monthEnd(month), cover.end].sort()[0] : null);
67
+ const current = windowMetric(id, module, start, end, cumulative);
68
+ const previous = windowMetric(id, module, validDate(start) ? priorDate(start) : null,
69
+ validDate(end) ? priorDate(end, end === monthEnd(end.slice(0, 7))) : null, cumulative);
70
+ let reason = !ready(current) ? `本期:${current.reason}` : !ready(previous) ? `去年同期:${previous.reason}` : previous.value <= 0 ? '去年同期为零或负数,不计算增长率' : null;
71
+ const value = reason ? null : (current.value - previous.value) / previous.value * 100;
72
+ if (!reason && !finite(value)) reason = '同比超出可表示范围';
73
+ return { label, unit: '%', value: reason ? null : value, state: reason ? 'pending' : 'available', reason,
74
+ current, previous, range: { start, end }, notes: validDate(start) && validDate(end) ? [`${start} 至 ${end};对比 ${previous.range.start} 至 ${previous.range.end}`] : [] };
75
+ }
76
+ function yearMonths(id, module, filters) {
77
+ const year = Number(filters.month.slice(0, 4)), selected = Number(filters.month.slice(5));
78
+ if (!Number.isInteger(year) || !selected) return [];
79
+ return Array.from({ length: 12 }, (_, index) => {
80
+ const month = `${year}-${String(index + 1).padStart(2, '0')}`;
81
+ const compare = yearComparison(id, module, { ...filters, period: 'month', month });
82
+ const previousMonth = `${year - 1}-${String(index + 1).padStart(2, '0')}`;
83
+ // A partial current month compares the same days in the background bar.
84
+ // Future slots may still show the prior year's complete month.
85
+ const previous = index + 1 <= selected && validDate(compare.current.range?.end) && compare.current.range.end >= `${month}-01`
86
+ ? compare.previous : windowMetric(id, module, `${previousMonth}-01`, monthEnd(previousMonth));
87
+ return { month, current: index + 1 <= selected ? compare.current : pending('净额', '元', '所选月之后尚不展示', 'missing'), previous };
88
+ });
89
+ }
90
+ function previousOpeningDays(module, comparison, currentPoints) {
91
+ const cover = model.payload.coverage.opening, previous = comparison.previous;
92
+ if (!validDate(previous.range.start) || !validDate(previous.range.end) || !validDate(cover?.start) || !validDate(cover?.end)
93
+ || cover.start > previous.range.start || cover.end < previous.range.end) return [];
94
+ const scoped = module.scopedRows || [], byDay = new Map();
95
+ const blocked = scoped.some(row => !validDate(row.date)) || model.payload.modules.opening.metrics?.bottles?.status === 'pending';
96
+ for (const row of scoped) if (row.date >= previous.range.start && row.date <= previous.range.end) {
97
+ if (!byDay.has(row.date)) byDay.set(row.date, []); byDay.get(row.date).push(row.bottles);
98
+ }
99
+ return currentPoints.map(point => {
100
+ const date = priorDate(point.date), values = byDay.get(date) || [];
101
+ const value = !blocked && date.slice(5) === point.date.slice(5) && values.length && values.every(finite) ? sum(values) : null;
102
+ return { date, value: finite(value) ? value : null, state: finite(value) ? 'available' : 'missing', reason: finite(value) ? null : '去年当日缺少有效记录,保留断点' };
103
+ });
104
+ }
105
+ function openingTotal(filters, module, ratio) {
106
+ const label = '总开瓶数(年累计共同期间)', unit = '瓶';
107
+ if (ready(ratio) && finite(ratio.numerator)) return { label, unit, value: ratio.numerator, state: 'available', reason: null, range: { ...ratio.range }, notes: [...ratio.notes] };
108
+ // Keep a known numerator visible when only the denominator is unusable.
109
+ // The window and source binding remain the confirmed cross-source contract.
110
+ const rule = model.payload.decisionContract?.crossTableMetrics, ids = ['opening', 'movement'];
111
+ if (model.payload.decisionContract?.version !== 1 || rule?.status !== 'confirmed' || ids.some(id => !rule.sources?.[id] || rule.sources[id] !== model.payload.sources[id]?.sha256))
112
+ return pending(label, unit, '这两个来源版本的共同期间关系尚未确认');
113
+ if (ids.some(id => model.payload.modules[id].state === 'unavailable')) return pending(label, unit, '缺少来源,无法确认共同截止日', 'missing');
114
+ if (!/^\d{4}-(0[1-9]|1[0-2])$/.test(filters.month || '')) return pending(label, unit, '所选月份无效,无法定位累计期间');
115
+ const covers = ids.map(id => model.payload.coverage?.[id]);
116
+ if (covers.some(cover => !validDate(cover?.start) || !validDate(cover?.end) || cover.start > cover.end)) return pending(label, unit, '来源期间缺失或无效,无法确认共同截止日');
117
+ const p = periodOf(filters), start = `${filters.month.slice(0, 4)}-01-01`, monthEnd = p.mode === 'range' ? p.end : new Date(Date.UTC(Number(filters.month.slice(0, 4)), Number(filters.month.slice(5, 7)), 0)).toISOString().slice(0, 10);
118
+ const end = [monthEnd, ...covers.map(cover => cover.end)].sort()[0], range = { start, end };
119
+ const fail = (reason, state = 'pending') => ({ ...pending(label, unit, reason, state), range });
120
+ if (end < start) return fail('来源截止日尚未覆盖所选年度', 'unavailable');
121
+ const source = model.payload.modules.opening;
122
+ if (covers[0].start.slice(0, 7) > start.slice(0, 7)) return fail('开瓶来源月份未覆盖累计窗口', 'unavailable');
123
+ if (source.records.some(row => !validDate(row.date))) return fail('开瓶来源存在日期缺失或无效,无法完整分期');
124
+ if (source.metrics?.bottles?.status === 'pending') return fail('开瓶瓶数来源规则或口径待确认');
125
+ for (let month = 1; month <= Number(end.slice(5, 7)); month++) {
126
+ const key = `${start.slice(0, 4)}-${String(month).padStart(2, '0')}`;
127
+ if (!source.records.some(row => row.date.slice(0, 7) === key && row.date <= end)) return fail('开瓶计算窗口有月份无来源记录,不能补零', 'unavailable');
128
+ }
129
+ const rows = (module.scopedRows || []).filter(row => row.date >= start && row.date <= end);
130
+ if (!rows.length) return fail('当前组织在共同期间没有开瓶来源记录', 'missing');
131
+ if (rows.some(row => !finite(row.bottles))) return fail('计算窗口存在缺失或不可用开瓶瓶数');
132
+ let value = 0, correction = 0;
133
+ for (const row of rows) { const next = row.bottles - correction, updated = value + next; correction = (updated - value) - next; value = updated; }
134
+ return finite(value) ? { label, unit, value, state: 'available', reason: null, range } : fail('开瓶合计超出可表示范围');
135
+ }
136
+ function regionalMetrics(filters, supplied) {
137
+ const key = keyFor(filters);
138
+ if (regionalCache.has(key)) return regionalCache.get(key);
139
+ const data = supplied || model.select(filters), modules = data.modules;
140
+ const terminal = modules.terminal, totals = terminal.structure?.totals;
141
+ const rate = totals?.effectiveRate;
142
+ const effectiveRate = terminal.state === 'unavailable'
143
+ ? pending('签约有效率', '%', '未接入有效签约来源', 'missing')
144
+ : finite(rate) ? { label: '签约有效率', unit: '%', value: rate * 100, state: 'available', reason: null,
145
+ numerator: totals.effectiveCount, denominator: totals.terminalCount }
146
+ : pending('签约有效率', '%', totals?.terminalCount === 0 ? '当前范围无签约终端,无法计算有效率' : '来源、日期、品系、件数或身份关联不足以完整判定');
147
+ const openingRate = copy(modules.opening.crossMetrics?.find(item => item.key === 'openingMovementRatio') || pending('总开瓶率', '%', '当前来源未确认该跨表指标'));
148
+ const result = { invoice: copy(modules.invoice.main), movement: copy(modules.movement.main), opening: copy(modules.opening.main), effectiveRate,
149
+ signed: copy(terminal.main), effectiveCount: copy(terminal.extra?.find(item => item.label === '有效终端数') || pending('有效终端数', '家', '有效终端尚未完整判定')),
150
+ openingRate, openingTotal: openingTotal(filters, modules.opening, openingRate),
151
+ ratio: copy(modules.movement.crossMetrics?.find(item => item.key === 'invoiceMovementMonthRatio')
152
+ || pending('当月动销 / 开票', '%', '当前来源未确认该跨表指标')) };
153
+ result.invoiceYoY = yearComparison('invoice', modules.invoice, filters);
154
+ result.movementYoY = yearComparison('movement', modules.movement, filters);
155
+ result.openingYoY = ready(result.openingTotal) && result.openingTotal.range
156
+ ? yearComparison('opening', modules.opening, filters, true, result.openingTotal.range)
157
+ : pending('累计开瓶同比', '%', result.openingTotal.reason || '共同期间未确认');
158
+ // Cache only small display metrics, not each selection's full source arrays.
159
+ regionalCache.set(key, result);
160
+ if (regionalCache.size > 96) regionalCache.delete(regionalCache.keys().next().value);
161
+ return result;
162
+ }
163
+ function openingTrend(data, filters) {
164
+ const source = model.payload.modules.opening, scoped = data.modules.opening.scopedRows || data.modules.opening.rows || [];
165
+ const coverage = model.payload.coverage?.opening;
166
+ const result = { openingDaily: [], openingPeriod: '来源期间未提供', openingState: { state: 'missing', reason: '未接入有效开瓶来源' } };
167
+ if (source.state === 'unavailable') return result;
168
+ if (!/^\d{4}-(0[1-9]|1[0-2])$/.test(filters.month || '')) {
169
+ result.openingState = { state: 'pending', reason: '所选月份无效,无法定位单月日度期间' };
170
+ return result;
171
+ }
172
+ if (!validDate(coverage?.start) || !validDate(coverage?.end) || coverage.start > coverage.end) {
173
+ result.openingState = { state: 'pending', reason: '开瓶来源覆盖期间缺失或无效,无法定位日度期间' };
174
+ return result;
175
+ }
176
+ const p = periodOf(filters), monthStart = p.mode === 'range' ? p.start : `${filters.month}-01`;
177
+ const monthEnd = p.mode === 'range' ? p.end : new Date(Date.UTC(Number(filters.month.slice(0, 4)), Number(filters.month.slice(5, 7)), 0)).toISOString().slice(0, 10);
178
+ const start = [monthStart, coverage.start].sort().at(-1), end = [monthEnd, coverage.end].sort()[0];
179
+ if (start > end) {
180
+ result.openingPeriod = '所选期间无来源覆盖';
181
+ result.openingState = { state: 'missing', reason: '所选期间不在开瓶来源覆盖期间内' };
182
+ return result;
183
+ }
184
+ result.openingPeriod = `${start} 至 ${end}`;
185
+ const unknownDate = scoped.some(row => !validDate(row.date));
186
+ const blocked = unknownDate ? '存在缺失或无效日期,无法完整分期' : source.metrics?.bottles?.status === 'pending' ? '开瓶瓶数来源规则或口径待确认' : null;
187
+ const byDay = new Map();
188
+ for (const row of scoped) {
189
+ if (!validDate(row.date) || row.date < start || row.date > end) continue;
190
+ if (!byDay.has(row.date)) byDay.set(row.date, []);
191
+ byDay.get(row.date).push(row.bottles);
192
+ }
193
+ for (let day = start; day <= end; day = new Date(Date.parse(`${day}T00:00:00Z`) + 86400000).toISOString().slice(0, 10)) {
194
+ const values = byDay.get(day) || [];
195
+ let value = null, state = 'pending', reason = blocked;
196
+ if (!blocked && !values.length) { state = 'missing'; reason = '当日无来源记录,不推定为零'; }
197
+ else if (!blocked && values.some(item => !finite(item))) reason = '当日存在缺失或不可用开瓶瓶数';
198
+ else if (!blocked) {
199
+ let sum = 0, correction = 0;
200
+ for (const item of values) { const next = item - correction, updated = sum + next; correction = (updated - sum) - next; sum = updated; }
201
+ if (finite(sum)) { value = sum; state = 'available'; reason = null; } else reason = '当日合计超出可表示范围';
202
+ }
203
+ result.openingDaily.push({ date: day, value, state, reason });
204
+ }
205
+ const points = result.openingDaily;
206
+ result.openingState = blocked ? { state: 'pending', reason: blocked }
207
+ : points.some(item => item.state === 'pending') ? { state: 'pending', reason: '部分日期瓶数不完整,图中保留断点' }
208
+ : points.some(item => item.state === 'available') ? { state: 'available', reason: points.some(item => item.state === 'missing') ? '缺日保留断点,不补零' : null }
209
+ : { state: 'missing', reason: '当前组织与期间内无开瓶来源记录' };
210
+ return result;
211
+ }
212
+ function describe(data, filters = model.defaults) {
213
+ const f = defaultFilters(filters), supplied = data || model.select(f), cacheKey = keyFor(f);
214
+ let byFilters = cache.get(supplied);
215
+ if (byFilters?.has(cacheKey)) return byFilters.get(cacheKey);
216
+ const groupField = ['region', 'office', 'unit'].includes(supplied.groupField) ? supplied.groupField : f.region === 'all' ? 'region' : f.office === 'all' ? 'office' : 'unit';
217
+ const keys = [...new Set((supplied.grouped || []).map(item => item.name))];
218
+ const expectedParts = groupField === 'region' ? 4 : groupField === 'office' ? 5 : 6;
219
+ const parentInvoice = supplied.modules.invoice.main;
220
+ const regional = keys.map(key => {
221
+ const selection = childFilters(f, groupField, key), parts = partsFor(key);
222
+ const metrics = regionalMetrics(selection, keyFor(selection) === cacheKey ? supplied : null);
223
+ const invoiceShare = ready(metrics.invoice) && ready(parentInvoice) && parentInvoice.value > 0 && finite(metrics.invoice.value / parentInvoice.value * 100)
224
+ ? { label: '发票占比', unit: '%', value: metrics.invoice.value / parentInvoice.value * 100, state: 'available', reason: null,
225
+ numerator: metrics.invoice.value, denominator: parentInvoice.value }
226
+ : pending('发票占比', '%', '当前组织或父范围发票净额不完整,或父范围合计不大于零');
227
+ return { key, name: model.label(key), fullName: fullName(key),
228
+ drillable: f.unit === 'all' && parts.length === expectedParts && parts.every(text) && model.organizations.some(item => item[groupField] === key),
229
+ ...Object.fromEntries(Object.entries(metrics).map(([name, item]) => [name, copy(item)])), invoiceShare };
230
+ });
231
+ const sourceEnds = Object.fromEntries(model.ids.filter(id => model.payload.modules[id].state !== 'unavailable')
232
+ .map(id => [id, validDate(model.payload.coverage?.[id]?.end) ? model.payload.coverage[id].end : null]));
233
+ const ends = [...new Set(Object.values(sourceEnds))];
234
+ const result = { regional, groupField, ...openingTrend(supplied, f),
235
+ openingGrowth: (({ groups, ...total }) => total)(supplied.modules.opening.dayChange || { ...pending('较昨日开瓶', '%', '当前数据未提供日度比较'), precision: 1 }),
236
+ sourceEndLabel: ends.length === 1 && ends[0] ? `截至 ${ends[0]}` : !ends.length || ends.every(value => value === null) ? '来源截止日期未提供' : '各来源截止不同', sourceEnds };
237
+ result.heroes = Object.fromEntries(['invoice', 'movement'].map(id => [id, {
238
+ monthly: yearMonths(id, supplied.modules[id], f), yoy: yearComparison(id, supplied.modules[id], f),
239
+ ytdYoY: yearComparison(id, supplied.modules[id], f, true),
240
+ }]));
241
+ result.openingYoY = yearComparison('opening', supplied.modules.opening, f);
242
+ result.openingPreviousDaily = previousOpeningDays(supplied.modules.opening, result.openingYoY, result.openingDaily);
243
+ if (!byFilters) { byFilters = new Map(); cache.set(supplied, byFilters); }
244
+ byFilters.set(cacheKey, result);
245
+ return result;
246
+ }
247
+ return { describe };
248
+ }
@@ -0,0 +1,264 @@
1
+ /* Simplified home, scoped to overview; detail layouts remain unchanged. */
2
+ body:has(.app-shell.overview-mode){background:#f1f3f6;overflow:auto}
3
+ body:has(.app-shell.overview-mode)::before,.app-shell.overview-mode::before{display:none}
4
+ .app-shell.overview-mode{--ov-num:"SF Pro Display","Inter","Helvetica Neue","Noto Sans",Arial,sans-serif;--ov-cn:"PingFang SC","HarmonyOS Sans SC","Noto Sans SC","Microsoft YaHei",sans-serif;position:relative;min-width:0;min-height:100dvh;width:100%;background:transparent;color:#18212b;font-family:var(--ov-cn);-webkit-font-smoothing:antialiased}
5
+ .app-shell.overview-mode main{position:static;display:flex;flex-direction:column;justify-content:center;width:1180px;max-width:none;min-height:100dvh;height:auto;margin:0 auto;padding:16px 0}
6
+ .app-shell.overview-mode main>*{max-width:none}
7
+ .app-shell.overview-mode .rail,.app-shell.overview-mode main>footer,.app-shell.overview-mode .page-header p{display:none}
8
+ .app-shell.overview-mode main>.page-header{display:flex;flex:none;flex-direction:row;align-items:flex-end;justify-content:space-between;width:100%;margin:0 0 24px;text-align:left}
9
+ .app-shell.overview-mode .page-header .eyebrow{font-family:var(--ov-num);font-size:10.5px;font-weight:500;line-height:1.5;letter-spacing:.32em;color:#b8343c;margin:0}
10
+ .app-shell.overview-mode .page-header h1{font-family:"Songti SC","Noto Serif CJK SC",serif;font-size:26px;font-weight:500;line-height:1.25;letter-spacing:.12em;color:#18212b;margin:8px 0 0}
11
+ .app-shell.overview-mode .header-actions{position:static;display:flex;flex-direction:row;align-items:center;gap:16px;padding:0;font-size:11.5px;line-height:1.5}
12
+ .app-shell.overview-mode .demo-badge{display:inline-flex;align-items:center;gap:8px;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none;color:#8a94a1;font-size:11.5px;font-weight:400;letter-spacing:0;white-space:nowrap}
13
+ .app-shell.overview-mode .demo-badge>span{width:6px;height:6px;border-radius:50%;background:#c9a85a;margin:0;box-shadow:none}
14
+ .app-shell.overview-mode .definition-button{display:inline-flex;align-items:center;gap:8px;padding:0;border:0;border-radius:0;background:none;box-shadow:none;color:#3a4552;font-size:11.5px;font-weight:400}
15
+ .app-shell.overview-mode .definition-button svg{display:none}
16
+ .app-shell.overview-mode main>.filter-bar{display:flex;flex:none;align-items:center;width:100%;height:44px;max-width:none;gap:0;margin:0;padding:0 8px 0 16px;border:1px solid #e6e9ee;border-radius:12px;background:#fff;box-shadow:none;backdrop-filter:none}
17
+ .app-shell.overview-mode .filter-label{display:none}
18
+ .app-shell.overview-mode .filter-bar label{display:flex;flex:1 1 0;align-items:center;gap:8px;min-width:0;height:100%;padding:0 16px;border-left:1px solid #edf0f3;line-height:1.5}
19
+ .app-shell.overview-mode .filter-bar label:nth-child(2){border-left:0;padding-left:0}
20
+ .app-shell.overview-mode .filter-bar label>span{display:inline;flex:none;color:#a8b0ba;font-size:11.5px;white-space:nowrap}
21
+ .app-shell.overview-mode .filter-bar select{flex:1 1 0;min-width:0;width:100%;max-width:100%;padding:0;border:0;border-radius:0;background:transparent;font-family:var(--ov-num),var(--ov-cn);font-size:12.5px;font-weight:500;color:#18212b;text-overflow:ellipsis;cursor:pointer}
22
+ .app-shell.overview-mode .filter-bar .reset-button{display:flex;flex:none;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:0;border-radius:8px;background:transparent;color:#8a94a1}
23
+ .app-shell.overview-mode .filter-bar .reset-button svg{width:15px;height:15px}
24
+ .app-shell.overview-mode main>.scope-line{display:flex;flex:none;align-items:center;justify-content:space-between;gap:24px;width:100%;min-height:16px;margin:8px 0 16px;font-size:11px;line-height:1.5;color:#a8b0ba}
25
+ .app-shell.overview-mode main>.scope-line:empty{min-height:0;height:0;margin:0 0 16px}
26
+ .app-shell.overview-mode .overview-shell{display:grid;flex:none;grid-template-columns:minmax(0,1fr) minmax(0,1fr) 288px;grid-template-rows:432px 248px;gap:16px;width:1180px;height:auto;margin:0;padding:0;border:0;border-radius:0;background:transparent;box-shadow:none}
27
+ .app-shell.overview-mode .overview-card{display:flex;flex-direction:column;min-width:0;min-height:0;margin:0;padding:24px;border:1px solid #e8ebef;border-radius:16px;background:#fff;box-shadow:none;color:#18212b;text-align:left}
28
+ .app-shell.overview-mode .ov-invoice{grid-column:1;grid-row:1;--ov-accent:#b8343c;--ov-light:#e2a3a8}
29
+ .app-shell.overview-mode .ov-movement{grid-column:2;grid-row:1;--ov-accent:#1f7a66;--ov-light:#9fcfc2}
30
+ .app-shell.overview-mode .ov-operations{grid-column:3;grid-row:1;padding:8px 24px}
31
+ .app-shell.overview-mode .ov-opening{grid-column:3;grid-row:2}
32
+ .app-shell.overview-mode .ov-regional{grid-column:1 / 3;grid-row:2}
33
+ .app-shell.overview-mode [role="button"],.app-shell.overview-mode button{cursor:pointer;font-family:inherit}
34
+ .app-shell.overview-mode :is(button,[role="button"],select):focus-visible{outline:2px solid #687e88;outline-offset:3px}
35
+ .app-shell.overview-mode .ov-heading{display:flex;flex:none;align-items:center;gap:8px;height:20px;min-width:0;margin:0;font-size:12.5px;font-weight:600;line-height:1.5;letter-spacing:0;color:#3a4552}
36
+ .app-shell.overview-mode .ov-heading :is(h2,h3){margin:0;font:inherit;white-space:nowrap}
37
+ .app-shell.overview-mode .ov-dot{display:inline-block;flex:none;width:6px;height:6px;border-radius:50%;background:#3a4552}
38
+ .app-shell.overview-mode .ov-hero .ov-dot{background:var(--ov-accent)}
39
+ .app-shell.overview-mode .ov-opening .ov-dot{background:#4a6f94}
40
+ .app-shell.overview-mode .ov-action{display:inline-flex;flex:none;margin-left:auto;font-size:11px;font-weight:400;line-height:1.5;color:#a8b0ba;white-space:nowrap}
41
+ .app-shell.overview-mode .ov-label{flex:none;margin:16px 0 0;font-size:11.5px;line-height:1.5;color:#8a94a1}
42
+ .app-shell.overview-mode :is(.ov-value,.ov-secondary-value,.ov-stats b,.ov-kv b,.ov-number,.ov-growth,.ov-previous,.ov-month,.ov-rank){font-family:var(--ov-num),var(--ov-cn);font-variant-numeric:tabular-nums lining-nums}
43
+ .app-shell.overview-mode .ov-hero-values{display:flex;align-items:flex-end;gap:24px;margin-top:8px;min-width:0}
44
+ .app-shell.overview-mode .ov-value{margin:0;font-size:44px;font-weight:300;line-height:1;letter-spacing:-.035em;white-space:nowrap}
45
+ .app-shell.overview-mode .ov-movement .ov-value{color:#16705d}
46
+ .app-shell.overview-mode :is(.ov-value,.ov-secondary-value) small{font-family:var(--ov-cn);font-size:13px;font-weight:400;letter-spacing:0;color:#a8b0ba;margin-left:8px}
47
+ .app-shell.overview-mode .ov-comparison{display:flex;flex-direction:column;gap:8px;padding-left:24px;border-left:1px solid #edf0f3;min-width:0;line-height:1.2;font-size:12px;color:#8a94a1;white-space:nowrap}
48
+ .app-shell.overview-mode .ov-growth{display:inline-flex;align-items:baseline;gap:8px;font-size:10.5px;line-height:1.3;white-space:nowrap;color:#8a94a1;font-weight:400}
49
+ .app-shell.overview-mode .ov-growth em{font-style:normal;font-weight:500}
50
+ .app-shell.overview-mode .ov-comparison .ov-growth{font-size:12px}
51
+ .app-shell.overview-mode .ov-hero-values .ov-growth em{font-size:14px}
52
+ .app-shell.overview-mode .ov-previous small{font-size:inherit;margin-left:3px;font-weight:400}
53
+ .app-shell.overview-mode .is-up{color:#1f7a66}
54
+ .app-shell.overview-mode :is(.is-down,.is-negative,.is-alert){color:#b8343c}
55
+ .app-shell.overview-mode .is-flat{color:#8a94a1}
56
+ .app-shell.overview-mode :is([data-state="pending"],[data-state="missing"],[data-state="unavailable"],.is-pending){color:#c3c9d0}
57
+ .app-shell.overview-mode .ov-stats{display:grid;flex:none;grid-template-columns:repeat(4,auto);justify-content:start;gap:0;margin-top:16px;padding-top:16px;border-top:1px solid #edf0f3;min-width:0}
58
+ .app-shell.overview-mode .ov-stats>div{padding:0 16px;border-left:1px solid #edf0f3;white-space:nowrap}
59
+ .app-shell.overview-mode .ov-stats>div:first-child{padding-left:0;border-left:0}
60
+ .app-shell.overview-mode .ov-stats>div:last-child{padding-right:0}
61
+ .app-shell.overview-mode .ov-stats>div>span:first-child{display:block;color:#a8b0ba;font-size:10.5px;line-height:1.3}
62
+ .app-shell.overview-mode .ov-stats b{display:block;margin-top:8px;font-size:15px;font-weight:500;line-height:1.3;letter-spacing:-.01em}
63
+ .app-shell.overview-mode .ov-stats small{font-size:10.5px;font-weight:400;color:#a8b0ba;margin-left:3px}
64
+ .app-shell.overview-mode .ov-stats .ov-growth{margin-top:8px}
65
+ .app-shell.overview-mode .ov-stats .ov-negative-amount,.app-shell.overview-mode .ov-negative-amount .is-negative{color:#a8761a}
66
+ .app-shell.overview-mode .ov-negative-amount:before,.app-shell.overview-mode .ov-negative-swatch{content:"";display:inline-block;width:8px;height:8px;border-radius:2px;background:repeating-linear-gradient(-45deg,#e7b75a 0 2px,#f6e3b8 2px 4px)}
67
+ .app-shell.overview-mode .ov-negative-amount:before{margin-right:8px}
68
+ .app-shell.overview-mode .ov-chart-header{display:flex;flex:none;align-items:center;justify-content:space-between;gap:16px;margin-top:16px;color:#a8b0ba;font-size:10.5px;line-height:1.3}
69
+ .app-shell.overview-mode .ov-chart-legend{display:flex;gap:16px}
70
+ .app-shell.overview-mode .ov-chart-legend>span{display:flex;align-items:center;gap:8px;white-space:nowrap}
71
+ .app-shell.overview-mode .ov-chart-legend i{display:inline-block;width:8px;height:8px;border-radius:2px}
72
+ .app-shell.overview-mode .ov-year-swatch{background:var(--ov-accent)}
73
+ .app-shell.overview-mode .ov-prior-swatch{background:#e3e6ea}
74
+ .app-shell.overview-mode .ov-chart{display:flex;flex:1;gap:8px;min-height:0;margin-top:16px}
75
+ .app-shell.overview-mode .ov-month{display:flex;flex:1;flex-direction:column;align-items:stretch;gap:8px;min-width:0;min-height:0;padding:0;border:0;border-radius:0;background:transparent;text-align:center}
76
+ .app-shell.overview-mode .ov-column{position:relative;display:block;flex:1;min-height:0;width:100%}
77
+ .app-shell.overview-mode .ov-net-lane{position:absolute;inset:0 0 30px}
78
+ .app-shell.overview-mode .ov-net-lane>i{position:absolute;display:block;border-radius:3px 3px 0 0}
79
+ .app-shell.overview-mode .ov-prior-net{left:0;right:0;background:#eef0f3}
80
+ .app-shell.overview-mode .ov-net{left:22%;right:22%;background:var(--ov-light)}
81
+ .app-shell.overview-mode .is-current .ov-net{background:var(--ov-accent)}
82
+ .app-shell.overview-mode .ov-net.is-negative{background:#b8343c;border-radius:0 0 3px 3px}
83
+ .app-shell.overview-mode .ov-zero{position:absolute;left:0;right:0;height:0;border-top:1px solid #dfe3e8;z-index:2}
84
+ .app-shell.overview-mode .ov-negative-lane{position:absolute;left:0;right:0;bottom:0;height:30px}
85
+ .app-shell.overview-mode .ov-deduction{position:absolute;top:0;left:22%;right:22%;display:block;border-radius:0 0 2px 2px;background:repeating-linear-gradient(-45deg,#e7b75a 0 2px,#f6e3b8 2px 4px)}
86
+ .app-shell.overview-mode .is-current .ov-deduction{background:repeating-linear-gradient(-45deg,#c98d1e 0 2px,#efcf8c 2px 4px)}
87
+ .app-shell.overview-mode .ov-net-label{position:absolute;left:50%;transform:translateX(-50%);padding-bottom:8px;font-size:10px;font-weight:500;line-height:1;white-space:nowrap}
88
+ .app-shell.overview-mode .ov-negative-label{position:absolute;top:0;left:100%;font-size:10px;font-weight:500;color:#a8761a;line-height:1;white-space:nowrap}
89
+ .app-shell.overview-mode .ov-month:last-child .ov-negative-label{left:auto;right:100%}
90
+ .app-shell.overview-mode .ov-month-label{font-size:10px;line-height:1;color:#a8b0ba;white-space:nowrap}
91
+ .app-shell.overview-mode .is-current .ov-month-label{font-weight:600;color:#18212b}
92
+ .app-shell.overview-mode .ov-missing{position:absolute;inset:0;display:grid;place-items:center;color:#c3c9d0;font-size:10px}
93
+ .app-shell.overview-mode .ov-chart-note{flex:none;line-height:1;font-size:10px;color:#a8b0ba;margin-top:8px}
94
+ .app-shell.overview-mode .ov-operation{display:flex;flex:1;flex-direction:column;justify-content:center;min-height:0;width:100%;padding:0;border:0;border-top:1px solid #edf0f3;border-radius:0;background:none;color:inherit;text-align:left}
95
+ .app-shell.overview-mode .ov-operation:first-child{border-top:0}
96
+ .app-shell.overview-mode .ov-operation-heading{display:flex;align-items:center;gap:8px;font-size:12px;font-weight:600;color:#3a4552}
97
+ .app-shell.overview-mode .ov-secondary-value{display:block;font-size:26px;font-weight:300;line-height:1.1;letter-spacing:-.03em;margin:8px 0 0;white-space:nowrap}
98
+ .app-shell.overview-mode .ov-secondary-value small{font-size:11px}
99
+ .app-shell.overview-mode .ov-kv{display:flex;gap:16px;margin-top:8px;font-size:10.5px;color:#a8b0ba;line-height:1.5;white-space:nowrap}
100
+ .app-shell.overview-mode .ov-kv b{font-size:11.5px;font-weight:500;margin-left:8px}
101
+ .app-shell.overview-mode .ov-kv small{font-size:10px;margin-left:3px}
102
+ .app-shell.overview-mode .ov-tag{background:none;border:0;padding:0;font-size:10.5px;color:#a8b0ba}
103
+ .app-shell.overview-mode .ov-tag [data-state="available"]{font-size:11.5px;color:#18212b;font-weight:500}
104
+ .app-shell.overview-mode .ov-kv b[data-state="available"]{color:#18212b}
105
+ .app-shell.overview-mode .ov-region-header{display:flex;align-items:center;gap:16px;min-height:20px}
106
+ .app-shell.overview-mode .ov-region-note{font-size:10.5px;color:#a8b0ba;white-space:nowrap}
107
+ .app-shell.overview-mode .ov-region-tabs{display:flex;gap:8px;margin-left:auto;white-space:nowrap}
108
+ .app-shell.overview-mode .ov-region-tabs button{padding:3px 8px;border:0;border-radius:6px;background:none;box-shadow:none;font-size:11px;font-weight:400;color:#8a94a1}
109
+ .app-shell.overview-mode .ov-region-tabs button[aria-selected="true"]{background:#f1f3f6;color:#18212b;font-weight:500}
110
+ .app-shell.overview-mode .ov-region-columns,.app-shell.overview-mode .ov-region-row{display:grid;grid-template-columns:24px 136px minmax(0,1fr) 96px 96px 72px;align-items:center;gap:16px;width:100%}
111
+ .app-shell.overview-mode .ov-region-columns{flex:none;margin-top:16px;padding:0 0 8px;border-bottom:1px solid #edf0f3;color:#a8b0ba;font-size:10.5px;line-height:1.3}
112
+ .app-shell.overview-mode .ov-region-columns>span:nth-last-child(-n+3){text-align:right}
113
+ .app-shell.overview-mode .ov-pair-legend{display:flex;gap:16px}
114
+ .app-shell.overview-mode .ov-pair-legend>span{display:flex;align-items:center;gap:8px}
115
+ .app-shell.overview-mode .ov-pair-legend i{width:8px;height:8px;border-radius:2px;display:inline-block}
116
+ .app-shell.overview-mode .ov-region-list{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;scrollbar-width:thin;scrollbar-color:#c3c9d0 transparent}
117
+ .app-shell.overview-mode .ov-region-row{height:calc(100% / 3);min-height:calc(100% / 3);padding:0;border:0;border-bottom:1px solid #f4f5f7;border-radius:0;background:none;text-align:left;outline-offset:-2px}
118
+ .app-shell.overview-mode .ov-region-row:disabled{cursor:default}
119
+ .app-shell.overview-mode .ov-region-row>*{min-width:0}
120
+ .app-shell.overview-mode .ov-region-row:last-child{border-bottom:0}
121
+ .app-shell.overview-mode .ov-rank{font-size:11px;color:#c3c9d0}
122
+ .app-shell.overview-mode .ov-region-name{font-size:12.5px;font-weight:500;line-height:1.4}
123
+ .app-shell.overview-mode .ov-region-name strong{display:block;font:inherit;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
124
+ .app-shell.overview-mode .ov-region-name>small{display:block;margin:0;font-size:10px;color:#a8b0ba;font-weight:400;line-height:1.4}
125
+ .app-shell.overview-mode .ov-region-bars{display:flex;flex-direction:column;gap:8px}
126
+ .app-shell.overview-mode .ov-region-bar-track{display:block;position:relative;height:6px;background:#f4f5f7;border-radius:3px}
127
+ .app-shell.overview-mode .ov-region-bar-track i{position:absolute;top:0;display:block;height:6px;border-radius:3px;max-width:100%}
128
+ .app-shell.overview-mode .ov-region-bar-track s{position:absolute;inset:0 auto 0;border-left:1px solid #c3c9d0}
129
+ .app-shell.overview-mode .ov-region-bar-track em{display:block;position:absolute;inset:0;line-height:6px;text-align:center;font-size:10px;color:#c3c9d0;font-style:normal}
130
+ .app-shell.overview-mode .ov-invoice-bar{background:#d27a80}
131
+ .app-shell.overview-mode .ov-movement-bar{background:#5aa592}
132
+ .app-shell.overview-mode .ov-signed-bar{background:#c4ad83}
133
+ .app-shell.overview-mode .ov-effectiveCount-bar{background:#5aa592}
134
+ .app-shell.overview-mode .ov-number{font-size:13.5px;font-weight:500;text-align:right;line-height:1.3;white-space:nowrap}
135
+ .app-shell.overview-mode .ov-number>.ov-growth{display:flex;justify-content:flex-end;margin:0;font-size:10.5px}
136
+ .app-shell.overview-mode .ov-number small{margin-left:3px;font-size:10.5px;font-weight:400}
137
+ .app-shell.overview-mode .ov-region-opening :is(.ov-region-columns,.ov-region-row){grid-template-columns:24px 1fr 160px 112px}
138
+ .app-shell.overview-mode .ov-region-foot{display:flex;flex:none;justify-content:space-between;gap:16px;margin-top:8px;font-size:10.5px;color:#a8b0ba;line-height:1.3}
139
+ .app-shell.overview-mode .ov-opening-value{display:block;margin-top:16px}
140
+ .app-shell.overview-mode .ov-opening .ov-secondary-value{margin:0}
141
+ .app-shell.overview-mode .ov-comparison-inline{flex-direction:row;align-items:baseline;gap:8px;border:0;padding:0;margin-top:8px;font-size:10.5px}
142
+ .app-shell.overview-mode .ov-comparison-inline .ov-growth{font-size:11px}
143
+ .app-shell.overview-mode .ov-comparison-inline .ov-previous{border-left:1px solid #edf0f3;padding-left:8px}
144
+ .app-shell.overview-mode .ov-sparkline{display:block;flex:1;width:100%;min-height:0;margin-top:16px;overflow:visible}
145
+ .app-shell.overview-mode .ov-day-axis{display:flex;justify-content:space-between;margin-top:8px;color:#a8b0ba;font-size:10px;line-height:1}
146
+ .app-shell.overview-mode .ov-opening-legend{display:flex;gap:16px;margin-top:8px;font-size:10.5px;color:#a8b0ba;line-height:1.3;white-space:nowrap}
147
+ .app-shell.overview-mode .ov-opening-legend i{display:inline-block;width:14px;height:0;border-top:1.6px solid #4a6f94;margin-right:8px}
148
+ .app-shell.overview-mode .ov-opening-legend i.is-prior{border-top:1.2px dashed #aab3bd}
149
+ .app-shell.overview-mode .ov-spark-empty{display:flex;flex:1;align-items:center;color:#c3c9d0;margin-top:16px}
150
+ .app-shell.overview-mode .ov-empty{margin:8px 0;color:#a8b0ba;font-size:11px}
151
+ @media(max-width:1211px){.app-shell.overview-mode{min-width:1212px}.app-shell.overview-mode main{margin:0 16px}}
152
+ @media(prefers-reduced-motion:reduce){.app-shell.overview-mode *{transition:none!important;scroll-behavior:auto!important}}
153
+
154
+ .app-shell.overview-mode .ov-day-change{display:flex;align-items:baseline;justify-content:space-between;gap:8px;margin-top:8px;padding:6px 8px;border-radius:6px;background:#f5f7fa;font-size:10.5px;line-height:1.3;white-space:nowrap;min-width:0}
155
+ .app-shell.overview-mode .ov-day-change .ov-growth em{font-size:11.5px}
156
+ .app-shell.overview-mode .ov-day-values{font-family:var(--ov-num),var(--ov-cn);font-variant-numeric:tabular-nums;color:#3a4552;overflow:hidden;text-overflow:ellipsis}
157
+ .app-shell.overview-mode .ov-day-values small{font-size:inherit;color:#8a94a1}
158
+
159
+ /* Filter area (2026-11-23, compact): start and end as two small boxes, one
160
+ quick-pick group that applies at once (incl. 恢复默认), 应用 and a full reset. */
161
+ .period-bar{display:flex;align-items:center;gap:10px;font-size:12px;color:#18212b}
162
+ .period-title{display:flex;align-items:center;gap:8px;color:#5f6b78;font-size:12px;white-space:nowrap}
163
+ .period-title svg{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.6}
164
+ .period-range{display:flex;align-items:center;gap:6px}
165
+ .period-date{display:flex;align-items:center;gap:6px;height:32px;padding:0 6px 0 10px;border:1px solid #dfe3e8;border-radius:9px;background:#fff;cursor:text;min-width:0}
166
+ .period-date>span{color:#8a94a1;font-size:11px;white-space:nowrap}
167
+ .period-date input{border:0;padding:0;background:transparent;color:#18212b;font:inherit;font-size:12.5px;font-weight:500;font-variant-numeric:tabular-nums;min-width:0;width:116px}
168
+ .period-date input:focus{outline:none}
169
+ .period-date:focus-within{border-color:#c99ba0;box-shadow:0 0 0 3px #f6e6e8}
170
+ .period-arrow{color:#a8b0ba;font-size:12px}
171
+ .period-quick{display:flex;background:#f1f3f6;border-radius:9px;padding:2px}
172
+ .period-quick button{height:28px;padding:0 12px;border:0;border-radius:7px;background:transparent;color:#3a4552;font-size:12px;cursor:pointer;white-space:nowrap}
173
+ .period-quick button:hover{color:#8f2933}
174
+ .period-quick button.is-active{background:#fff;color:#8f2933;font-weight:500;box-shadow:0 1px 2px rgba(0,0,0,.08)}
175
+ .period-apply{height:32px;padding:0 16px;border:0;border-radius:9px;background:#8f2933;color:#fff;font-size:12px;cursor:pointer;white-space:nowrap}
176
+ .period-apply:disabled{background:#d9c3c6;cursor:not-allowed}
177
+ .period-clear{width:32px;height:32px;flex:none;border:1px solid #e1e5ea;border-radius:9px;background:#fff;color:#76838e;font-size:15px;line-height:1;cursor:pointer}
178
+ .period-clear:hover{color:#8f2933;border-color:#e3d3d5}
179
+ .period-note{margin-left:auto;color:#8a94a1;font-size:11.5px;white-space:nowrap}
180
+ .period-note.is-error{color:#b8343c}
181
+ /* Overview: two rows inside one white card; the shell reset is replaced by ↺. */
182
+ .app-shell.overview-mode main>.filter-bar{flex-wrap:wrap;height:auto;padding:0;gap:0;border-radius:14px}
183
+ .app-shell.overview-mode main>.filter-bar>.period-bar{order:-1;flex:1 0 100%;height:52px;padding:0 16px;border-bottom:1px solid #eef0f3}
184
+ .app-shell.overview-mode main>.filter-bar>.filter-label{display:flex;height:46px;align-items:center;gap:8px;padding:0 16px;font-size:12px;color:#5f6b78;border:0}
185
+ .app-shell.overview-mode main>.filter-bar>.filter-label svg{width:16px;height:16px}
186
+ .app-shell.overview-mode main>.filter-bar>label{height:46px;border-left:1px solid #eef0f3;padding:0 16px}
187
+ .app-shell.overview-mode .filter-bar label:nth-child(2),.app-shell.overview-mode .filter-bar label:nth-child(3){border-left:1px solid #eef0f3;padding-left:16px}
188
+ .app-shell.overview-mode main>.filter-bar>.reset-button{display:none}
189
+ .app-shell.overview-mode .period-bar .period-clear{order:9}
190
+ /* Details: compact left card without a title row. Row 1: start → end;
191
+ row 2: quick picks and ↺; then two-by-two single-line dropdowns. */
192
+ .app-shell.detail-mode main>.filter-bar{grid-template-columns:repeat(2,minmax(0,1fr));position:relative;top:14px;gap:0 20px;padding:16px 20px 10px;border-radius:19px;background:linear-gradient(140deg,#fff,#f7f9fa)}
193
+ .app-shell.detail-mode main>.filter-bar>.filter-label,.app-shell.detail-mode main>.filter-bar>.reset-button{display:none}
194
+ .app-shell.detail-mode main>.filter-bar>.period-bar{grid-column:1/-1;display:grid;grid-template-columns:minmax(0,1fr) auto;gap:10px 6px;padding:0 0 10px;margin-bottom:2px;border-bottom:1px solid #e9edf1}
195
+ .app-shell.detail-mode .period-bar .period-title,.app-shell.detail-mode .period-bar .period-note{display:none}
196
+ .app-shell.detail-mode .period-bar .period-range{grid-column:1/-1;display:grid;grid-template-columns:minmax(0,1fr) 12px minmax(0,1fr);gap:4px}
197
+ .app-shell.detail-mode main>.filter-bar .period-date{height:29px;padding:0 0 5px;background:transparent;border:0;border-bottom:1px solid #c5cfd6;border-radius:0}
198
+ .app-shell.detail-mode .period-bar .period-date input{width:100%;font-size:14px}
199
+ .app-shell.detail-mode .period-bar .period-arrow{text-align:center}
200
+ .app-shell.detail-mode .period-bar .period-quick{display:flex;justify-self:start}
201
+ .app-shell.detail-mode .period-bar .period-quick button{height:26px;padding:0 11px;font-size:12px}
202
+ .app-shell.detail-mode .period-bar .period-clear{width:30px;height:26px;align-self:center;border:0;border-left:1px solid #d9e1e5;border-radius:0;background:transparent}
203
+ .app-shell.detail-mode main>.filter-bar>label{flex-direction:row;align-items:center;gap:8px;height:32px;padding:0;border-bottom:1px dashed #edf0f4}
204
+ .app-shell.detail-mode main>.filter-bar>label:nth-last-of-type(-n+2){border-bottom:0}
205
+ .app-shell.detail-mode main>.filter-bar>label>span{min-width:44px;font-size:11px;color:#8a94a1}
206
+ .up-level{display:inline-flex;align-items:center;gap:6px;margin-left:10px;padding:2px 10px;border:1px solid #e3d3d5;border-radius:999px;background:#fff;color:#8f2933;font-size:11px;line-height:1.6;cursor:pointer;white-space:nowrap}
207
+ .up-level small{color:#8a94a1;font-size:10.5px}
208
+ .up-level:hover{background:#fbf3f4}
209
+ .up-level.is-compact{margin-left:8px;padding:1px 8px}
210
+ .v10-up-level{margin:0 0 10px}
211
+
212
+ /* 随窗口自适应(2026-11-25 用户确认预览):总览宽屏三列、≤1100 两列、≤760 单列;
213
+ 详情 ≥760 保持左右独立滚动,≤760 上下排列。外壳 v10-shell.html 不改,此处覆盖其固定宽度。 */
214
+ @media(max-width:1000px){.app-shell{min-width:0}}
215
+ @media(max-width:1211px){.app-shell.overview-mode{min-width:0}.app-shell.overview-mode main{margin:0 auto}}
216
+ .app-shell.overview-mode main{width:auto;max-width:1480px;margin:0 auto;padding:16px clamp(12px,2.4vw,32px);justify-content:flex-start}
217
+ .app-shell.overview-mode .page-header{flex-wrap:wrap;gap:8px 16px}
218
+ .app-shell.overview-mode .filter-bar{flex-wrap:wrap;height:auto}
219
+ .app-shell.overview-mode .filter-bar .period-bar{flex:1 1 100%;flex-wrap:wrap;row-gap:8px;height:auto;min-height:52px;padding-top:8px;padding-bottom:8px}
220
+ .app-shell.overview-mode .filter-bar>label{flex:1 1 200px;min-width:0}
221
+ .app-shell.overview-mode .overview-shell{width:auto;grid-template-columns:minmax(0,1fr) minmax(0,1fr) minmax(260px,300px);grid-template-rows:auto auto}
222
+ .app-shell.overview-mode .ov-hero{height:auto;min-height:432px}
223
+ .app-shell.overview-mode :is(.ov-regional,.ov-opening,.ov-operations){height:auto;min-height:248px}
224
+ .app-shell.overview-mode .ov-region-list{flex:none;max-height:300px;overflow-y:auto}
225
+ .app-shell.overview-mode .ov-region-row{height:auto;min-height:52px;padding:6px 0}
226
+ .app-shell.overview-mode .ov-operation{flex:1 0 auto;min-height:104px;padding:12px 0}
227
+ @media(max-width:1100px){
228
+ .app-shell.overview-mode .overview-shell{grid-template-columns:repeat(2,minmax(0,1fr))}
229
+ .app-shell.overview-mode .ov-invoice{grid-column:1;grid-row:1}
230
+ .app-shell.overview-mode .ov-movement{grid-column:2;grid-row:1}
231
+ .app-shell.overview-mode .ov-regional{grid-column:1 / -1;grid-row:2}
232
+ .app-shell.overview-mode .ov-operations{grid-column:1;grid-row:3}
233
+ .app-shell.overview-mode .ov-opening{grid-column:2;grid-row:3}
234
+ }
235
+ @media(max-width:760px){
236
+ .app-shell.overview-mode .overview-shell{grid-template-columns:minmax(0,1fr)}
237
+ .app-shell.overview-mode :is(.ov-invoice,.ov-movement,.ov-regional,.ov-operations,.ov-opening){grid-column:1}
238
+ .app-shell.overview-mode .ov-invoice{grid-row:1}
239
+ .app-shell.overview-mode .ov-movement{grid-row:2}
240
+ .app-shell.overview-mode .ov-regional{grid-row:3}
241
+ .app-shell.overview-mode .ov-operations{grid-row:4}
242
+ .app-shell.overview-mode .ov-opening{grid-row:5}
243
+ .app-shell.overview-mode :is(.ov-region-columns,.ov-region-row){grid-template-columns:20px minmax(90px,120px) minmax(0,1fr) 72px 72px;gap:10px}
244
+ .app-shell.overview-mode :is(.ov-region-columns,.ov-region-row)>:last-child{display:none}
245
+ }
246
+ .app-shell.detail-mode .details-panel{min-width:0}
247
+ @media(max-width:1000px){
248
+ .app-shell.detail-mode main{grid-template-columns:minmax(280px,320px) minmax(0,1fr);padding:16px 16px 12px}
249
+ .app-shell.detail-mode .v10-details .detail-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}
250
+ .app-shell.detail-mode main>.filter-bar>label{flex-direction:column;align-items:stretch;gap:2px;height:auto}
251
+ .app-shell.detail-mode main>.filter-bar>label select{width:100%}
252
+ .app-shell.detail-mode .period-bar .period-range{grid-template-columns:minmax(0,1fr)}
253
+ .app-shell.detail-mode .period-bar .period-arrow{display:none}
254
+ }
255
+ @media(max-width:760px){
256
+ .app-shell.detail-mode main{display:flex;flex-direction:column;height:auto;min-height:0;padding:12px}
257
+ .app-shell.detail-mode main>.filter-bar{position:static;width:100%}
258
+ .app-shell.detail-mode main>.filter-bar>label{flex-direction:row;align-items:center}
259
+ .app-shell.detail-mode .period-bar .period-range{grid-template-columns:minmax(0,1fr) 12px minmax(0,1fr)}
260
+ .app-shell.detail-mode .period-bar .period-arrow{display:block}
261
+ .app-shell.detail-mode .focus-layout{display:block;width:100%}
262
+ .app-shell.detail-mode .focus-summary{position:static;display:flex;flex:none;flex-direction:column;gap:12px;width:100%;height:auto;min-height:0;padding:0 0 12px;background:none;overflow:hidden;container-type:inline-size}
263
+ .app-shell.detail-mode .details-panel{width:auto;max-width:100%;height:auto;margin:0;overflow-x:auto;overflow-y:visible}
264
+ }