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()

insert1 = '\n\n/* 收入确认环比列固定宽度，保证上下行对齐 */\n.flow-detail-right .compare-text-up-xs,\n.flow-detail-right .compare-text-down-xs,\n.flow-detail-right .compare-text-up-sm,\n.flow-detail-right .compare-text-down-sm {\n  min-width: 72rpx;\n  text-align: right;\n  display: block;\n}'

insert2 = '\n\n/* 合计行环比列固定宽度 */\n.flow-total-right .compare-text-up-xs,\n.flow-total-right .compare-text-down-xs,\n.flow-total-right .compare-text-up-sm,\n.flow-total-right .compare-text-down-sm {\n  min-width: 72rpx;\n  text-align: right;\n  display: block;\n}'

# Insert after .flow-detail-val block
marker1 = '.flow-detail-val--red {'
idx1 = content.find(marker1)
if idx1 != -1:
    content = content[:idx1] + insert1.lstrip('\n') + '\n\n' + content[idx1:]
    print('inserted detail compare rule')
else:
    print('marker1 not found')

# Insert after .flow-total-value block  
marker2 = '/* ===== 现金流入 - 流水项 ===== */'
idx2 = content.find(marker2)
if idx2 != -1:
    content = content[:idx2] + insert2.lstrip('\n') + '\n\n' + content[idx2:]
    print('inserted total compare rule')
else:
    print('marker2 not found')

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