path = r'c:\NeoZQYY\apps\miniprogram\miniprogram\pages\board-finance\board-finance.wxss'
with open(path, 'r', encoding='utf-8') as f:
    content = f.read()

# 1. 现金流入: flow-item-right 改为同行 flex row
old1 = '.flow-item-right {\n  display: flex;\n  flex-direction: column;\n  align-items: flex-end;\n}'
new1 = '.flow-item-right {\n  display: flex;\n  flex-direction: row;\n  align-items: center;\n  gap: 0;\n}'
if old1 in content: content = content.replace(old1, new1, 1); print('1 OK')
else: print('1 NOT FOUND')

# 2. 现金流入: flow-item-value 加 min-width
old2 = '.flow-item-value {\n  font-size: 30rpx;\n  line-height: 44rpx;\n  font-weight: 600;\n  color: #242424;\n}'
new2 = '.flow-item-value {\n  font-size: 30rpx;\n  line-height: 44rpx;\n  font-weight: 600;\n  color: #242424;\n  min-width: 130rpx;\n  text-align: right;\n}'
if old2 in content: content = content.replace(old2, new2, 1); print('2 OK')
else: print('2 NOT FOUND')

# 3. 助教: coach-fin-col 改为 flex 列布局
old3 = '.coach-fin-col {\n  text-align: right;\n}'
new3 = '.coach-fin-col {\n  text-align: right;\n  display: flex;\n  flex-direction: column;\n  align-items: flex-end;\n  justify-content: center;\n}'
if old3 in content: content = content.replace(old3, new3, 1); print('3 OK')
else: print('3 NOT FOUND')

# 4. 助教: coach-fin-bold 加 min-width
old4 = '.coach-fin-bold {\n  font-size: 26rpx;\n  line-height: 36rpx;\n  font-weight: 600;\n  color: #242424;\n  display: block;\n}'
new4 = '.coach-fin-bold {\n  font-size: 26rpx;\n  line-height: 36rpx;\n  font-weight: 600;\n  color: #242424;\n  display: block;\n  min-width: 100rpx;\n  text-align: right;\n}'
if old4 in content: content = content.replace(old4, new4, 1); print('4 OK')
else: print('4 NOT FOUND')

# 5. 助教: coach-fin-val 加 min-width
old5 = '.coach-fin-val {\n  font-size: 26rpx;\n  line-height: 36rpx;\n  color: #5e5e5e;\n  display: block;\n}'
new5 = '.coach-fin-val {\n  font-size: 26rpx;\n  line-height: 36rpx;\n  color: #5e5e5e;\n  display: block;\n  min-width: 100rpx;\n  text-align: right;\n}'
if old5 in content: content = content.replace(old5, new5, 1); print('5 OK')
else: print('5 NOT FOUND')

# 6. 现金流入环比固定宽度
marker = '.flow-item-value {'
insert = '\n/* 现金流入环比列固定宽度 */\n.flow-item-right .compare-text-up-xs,\n.flow-item-right .compare-text-down-xs,\n.flow-item-right .compare-text-up-sm,\n.flow-item-right .compare-text-down-sm {\n  min-width: 72rpx;\n  text-align: right;\n  display: block;\n}\n'
idx = content.find(marker)
if idx != -1: content = content[:idx] + insert + content[idx:]; print('6 OK')
else: print('6 NOT FOUND')

with open(path, 'w', encoding='utf-8') as f:
    f.write(content)
print('all done')
