<template>
	<!-- 我的钱包 -->
	<view class="wallet-page">
		<view class="wallet-bg">
			<view class="wallet-aura aura-green"></view>
			<view class="wallet-aura aura-blue"></view>
			<view class="wallet-aura aura-yellow"></view>
		</view>

		<view class="wallet-nav" :style="{'padding-top': menuButtonInfo.top +'px'}">
			<view class="back-btn" @tap="back">
				<text>‹</text>
			</view>
			<view class="title-name">我的钱包</view>
		</view>

		<scroll-view scroll-y class="wallet-scroll" :show-scrollbar="false" @scrolltolower="loadMoreFlow">
			<view class="wallet-content">
				<view class="wallet-tabs" v-if="walletTabs.length">
					<view class="tab-slider" :style="{ width: tabSliderWidth, transform: tabSliderTransform }"></view>
					<view
						class="wallet-tab"
						v-for="(tab,index) in walletTabs"
						:key="index"
						:class="{active: activeWalletType === tab.key}"
						@tap="switchWallet(tab.key,index)">
						{{tab.name}}
					</view>
				</view>

				<view class="hero-card enter-card" :class="activeWallet.heroClass" @tap="chooseLinkId(activeWallet.type, activeWallet.raw)">
					<view class="hero-copy">
						<view class="hero-label">{{activeWallet.title}}</view>
						<view class="hero-amount amount-roll">
							<text>￥</text>{{formatMoney(activeWallet.amount)}}
						</view>
						<view class="hero-safe">余额安全保障中</view>
					</view>
					<view class="hero-icon">
						<text>{{activeWallet.icon}}</text>
					</view>
					<view class="withdraw-btn" @tap.stop="userCommion(activeWallet.type, activeWallet.withdrawAmount, activeWallet.raw)">
						提现
					</view>
				</view>

				<view class="shop-switch" v-if="activeWalletType === 'shop' && shopWallets.length > 1">
					<view
						class="shop-pill"
						v-for="(shop,index) in shopWallets"
						:key="index"
						:class="{active: activeShopIndex === index}"
						@tap="switchShop(index)">
						{{shop.shopName || ('店铺' + (index + 1))}}
					</view>
				</view>

				<view class="quick-grid enter-card">
					<view class="quick-item" v-for="(item,index) in actionEntries" :key="index" @tap="handleAction(item)">
						<view class="quick-icon" :class="item.color">{{item.icon}}</view>
						<view class="quick-name">{{item.name}}</view>
					</view>
				</view>

				<view class="stats-grid">
					<view class="stat-card enter-card" v-for="(item,index) in displayStats" :key="index" :style="{animationDelay: item.delay}">
						<view class="stat-label">{{item.label}}</view>
						<view class="stat-value">{{item.value}}</view>
					</view>
				</view>

				<view class="section-head enter-card">
					<view>
						<view class="section-kicker">RECENT FLOW</view>
						<view class="section-title">余额明细</view>
					</view>
				</view>

				<view class="timeline-list">
					<view class="flow-card enter-card" v-for="(item,index) in displayRewardLists" :key="index" :style="{animationDelay: item.delay}">
						<view class="flow-icon" :class="item.amountClass">
							<text>{{item.flowIcon}}</text>
						</view>
						<view class="flow-main">
							<view class="flow-title">{{item.dealingsWay || '余额变动'}}</view>
							<view class="flow-time">{{item.createTime || '刚刚'}}</view>
						</view>
						<view class="flow-amount" :class="item.amountClass">
							{{item.amountText}}
						</view>
					</view>
					<view class="empty-card" v-if="!rewardLists.length && loadStatus !== 'loading'">
						最近还没有余额流水
					</view>
				</view>

				<uni-load-more :status="loadStatus" />
				<view class="bottom-space"></view>
			</view>
		</scroll-view>
		<!-- 出层 -->
		<uni-popup ref="payPopup" background-color="transparent">
			<view class="withdraw-popup">
				<view class="popup-title">提现到支付宝</view>
				<view class="popup-field">
					<text>支付宝实名</text>
					<input type="text" v-model="aliName" placeholder="请输入姓名" />
				</view>
				<view class="popup-field">
					<text>支付宝认证手机号</text>
					<input type="digit" v-model="aliAccount" placeholder="请输入手机号" />
				</view>
				<view class="popup-field">
					<text>提现金额</text>
					<input type="digit" v-model="commionAmount" placeholder="请输入金额" />
				</view>
				<view class="popup-btn" :style="{opacity: submittingWithdraw ? 0.6 : 1}" @tap="wxPayment">
					{{submittingWithdraw ? '提现中...' : '确认提现'}}
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				menuButtonInfo: {},
				balanceUser:{},
				loadStatus: 'more',
				balanceWorker:{},
				rewardLists:[],
				aliName:'',
				aliAccount:'',
				commionType:'',
				shopId:'',
				workerId:'',
				userId:'',
				searchForm:{
					pageNum:1,
					pageSize:10
				},
				indicatorDots: false,
				interval: 4000,
				onlineWorkerInterval:4000,
				totalPages: 1,
				commionUrl:'',
				commionAmount:0,
				linkId:'',
				activeWalletType: 'user',
				activeTabIndex: 0,
				activeShopIndex: 0,
				targetWalletType: '',
				autoplay: true,
				balanceShop:[],
				submittingWithdraw: false,
				withdrawRequestId: '',
			}
		},
		computed: {
			shopWallets() {
				if (Array.isArray(this.balanceShop)) return this.balanceShop
				return this.balanceShop && typeof this.balanceShop === 'object' ? [this.balanceShop] : []
			},
			hasWorkerWallet() {
				return !!(this.balanceWorker && (this.balanceWorker.workerId || this.balanceWorker.id || this.balanceWorker.depoBal || this.balanceWorker.depoBalRel))
			},
			hasShopWallet() {
				return this.shopWallets.length > 0
			},
			walletTabs() {
				const tabs = [{ key: 'user', name: '用户钱包' }]
				if (this.hasWorkerWallet) tabs.push({ key: 'worker', name: '配送钱包' })
				if (this.hasShopWallet) tabs.push({ key: 'shop', name: '商家钱包' })
				return tabs
			},
			tabSliderWidth() {
				const count = this.walletTabs.length || 1
				return (100 / count) + '%'
			},
			tabSliderTransform() {
				return `translateX(${this.activeTabIndex * 100}%)`
			},
			currentShop() {
				return this.shopWallets[this.activeShopIndex] || this.shopWallets[0] || {}
			},
			activeWallet() {
				if (this.activeWalletType === 'worker') {
					return {
						type: 'worker',
						heroClass: 'hero-worker',
						title: '配送佣金余额',
						amount: this.balanceWorker.depoBal,
						withdrawAmount: this.balanceWorker.depoBalRel,
						icon: 'DEL',
						raw: this.balanceWorker
					}
				}
				if (this.activeWalletType === 'shop') {
					return {
						type: 'shop',
						heroClass: 'hero-shop',
						title: '商家余额',
						amount: this.currentShop.balance,
						withdrawAmount: this.currentShop.balance,
						icon: 'SHOP',
						raw: this.currentShop
					}
				}
				return {
					type: 'user',
					heroClass: 'hero-user',
					title: '用户余额',
					amount: this.balanceUser.depoBal,
					withdrawAmount: this.balanceUser.depoBal,
					icon: 'USER',
					raw: this.balanceUser
				}
			},
			activeStats() {
				if (this.activeWalletType === 'worker') {
					return [
						{ label: '今日收入', value: this.formatMoney(this.balanceWorker.depoBal) },
						{ label: '配送单数', value: this.balanceWorker.orderCount || this.balanceWorker.todayOrderCount || 0 },
						{ label: '本周收入', value: this.formatMoney(this.balanceWorker.weekIncome || this.balanceWorker.depoBal) },
						{ label: '待结算', value: this.formatMoney(this.balanceWorker.waitSettle || this.balanceWorker.depoBalRel) }
					]
				}
				if (this.activeWalletType === 'shop') {
					return [
						{ label: '今日营业额', value: this.formatMoney(this.currentShop.todayIncome || this.currentShop.balance) },
						{ label: '待结算', value: this.formatMoney(this.currentShop.waitSettle || 0) },
						{ label: '累计营业额', value: this.formatMoney(this.currentShop.totalIncome || this.currentShop.balance) },
						{ label: '可提现', value: this.formatMoney(this.currentShop.balance) }
					]
				}
				return [
					{ label: '可提现', value: this.formatMoney(this.balanceUser.depoBal) },
					{ label: '今日收益', value: this.formatMoney(this.balanceUser.todayIncome || 0) },
					{ label: '累计收益', value: this.formatMoney(this.balanceUser.totalIncome || this.balanceUser.depoBal) },
					{ label: '冻结金额', value: this.formatMoney(this.balanceUser.freezeAmount || 0) }
				]
			},
			actionEntries() {
				return [
					{ name: '提现', icon: '提', color: 'green', action: () => this.userCommion(this.activeWallet.type, this.activeWallet.withdrawAmount, this.activeWallet.raw) },
					{ name: '余额明细', icon: '明', color: 'blue', action: () => this.rewardList() },
					{ name: '提现记录', icon: '记', color: 'yellow', action: () => this.rewardList() },
					{ name: '资金规则', icon: '规', color: 'purple', action: null }
				]
			},
			displayStats() {
				return this.activeStats.map((item, index) => {
					return Object.assign({}, item, {
						delay: (index * 0.05) + 's'
					})
				})
			},
			displayRewardLists() {
				return (this.rewardLists || []).map((item, index) => {
					const amountClass = this.amountClass(item.amount)
					return Object.assign({}, item, {
						amountClass,
						amountText: this.formatSignedAmount(item.amount),
						flowIcon: this.flowIcon(item.dealingsWay),
						delay: (index * 0.04) + 's'
					})
				})
			}
		},
		onLoad(option) {
			if (option && option.walletType) {
				this.targetWalletType = option.walletType
			}
		},
		onShow() {
			this.menuButtonInfo = uni.getMenuButtonBoundingClientRect()
			this.balanceUser = 0
			this.balanceWorker = 0
			this.balanceShop = []
			this.beginData();
		},
		onReachBottom() {
			
			if (this.searchForm.pageNum >= this.totalPages) return;
			// this.status = 'loading';
			this.searchForm.pageNum+=1;
			this.rewardList();
		
		},
		methods: {
			beginData(){
				this.tui.request("/worker/getAllDepo/", "GET", {userId:uni.getStorageSync('id')}, false, true).then((res) => {
					if (res.code == 200) {
						if(res.result.user){
							this.balanceUser = res.result.user
						}
						if(res.result.worker){
							this.balanceWorker = res.result.worker
						}
						if(res.result.shop){
							this.balanceShop = res.result.shop
						}
						this.syncActiveWallet()
						this.$forceUpdate();
					} else {
						this.tui.toast(res.message)
					}
					uni.hideLoading()
				}).catch((res) => {})
			},
			//提现
			withDraw(){
				uni.showToast({
					title:'提现成功'
				})
			},
			userCommion(type,commion,item){
				if(type=='user'){
					this.commionUrl = '/app/returnCommission/handleReturnUser'
				}else if(type=='worker'){
					this.commionUrl = '/app/returnCommission/handleReturnWorker'
				}else{
					this.commionUrl = '/app/returnCommission/handleReturn'
					this.shopId = item.id
				}
				this.commionAmount = commion
				this.commionType = type
				this.submittingWithdraw = false
				this.withdrawRequestId = this.createWithdrawRequestId()
				this.$refs.payPopup.open();
			},
			createWithdrawRequestId(){
				return `${Date.now()}${Math.floor(Math.random() * 1000000)}`
			},
			syncActiveWallet(){
				if (this.targetWalletType) {
					const targetIndex = this.walletTabs.findIndex(tab => tab.key === this.targetWalletType)
					if (targetIndex >= 0) {
						this.activeWalletType = this.targetWalletType
						this.activeTabIndex = targetIndex
						this.targetWalletType = ''
					}
				}
				const currentIndex = this.walletTabs.findIndex(tab => tab.key === this.activeWalletType)
				if (currentIndex >= 0) {
					this.activeTabIndex = currentIndex
				} else {
					this.activeWalletType = 'user'
					this.activeTabIndex = 0
				}
				if (this.activeWalletType === 'shop' && this.activeShopIndex >= this.shopWallets.length) {
					this.activeShopIndex = 0
				}
				this.setCurrentLinkId()
			},
			setCurrentLinkId(){
				if (this.activeWalletType === 'worker') {
					this.linkId = this.balanceWorker.workerId
				} else if (this.activeWalletType === 'shop') {
					this.linkId = this.currentShop.id
				} else {
					this.linkId = this.balanceUser.id
				}
				this.searchForm.pageNum = 1
				if (!this.linkId) {
					this.rewardLists = []
					this.loadStatus = 'nomore'
					return
				}
				this.rewardList()
			},
			switchWallet(type,index){
				if (this.activeWalletType === type) return
				this.activeWalletType = type
				this.activeTabIndex = index
				this.setCurrentLinkId()
			},
			switchShop(index){
				if (this.activeShopIndex === index) return
				this.activeShopIndex = index
				this.setCurrentLinkId()
			},
			handleAction(item){
				if (item && item.action) item.action()
			},
			loadMoreFlow(){
				if (this.searchForm.pageNum >= this.totalPages) return
				this.searchForm.pageNum += 1
				this.rewardList()
			},
			wxPayment(){
				let that = this
				if (this.submittingWithdraw) {
					that.tui.toast('提现处理中，请勿重复提交')
					return
				}
				const amount = Number(this.commionAmount)
				if(!amount || amount < 1 || amount > 5000){
					that.tui.toast('单笔提现金额应在1-5000之间')
					return
				}
				if(!this.aliName){
					that.tui.toast('支付宝实名名称不能为空')
					return
				}
				if(!this.aliAccount){
					that.tui.toast('支付宝手机号不能为空')
					return
				}
				this.submittingWithdraw = true
				let data = {
					id:this.withdrawRequestId || this.createWithdrawRequestId(),
					commission:amount,
					aliName:this.aliName,
					aliAccount:this.aliAccount
				}
				if(this.commionType == 'user'){
					data.userId = this.balanceUser.id
				}else if(this.commionType == 'worker'){
					data.workerId = this.balanceWorker.workerId
				}else{
					data.shopId = this.shopId
				}
				that.tui.request(this.commionUrl, "POST", data, false, false).then((res) => {
					that.loadStatus = 'nomore';
					if (res.code == 200) {
						this.$refs.payPopup.close();
						this.withdrawRequestId = ''
						this.beginData();
					} else {
						that.tui.toast(res.message)
						that.submittingWithdraw = false
						return
					}
					that.submittingWithdraw = false
					uni.hideLoading()
				}).catch((res) => {
					that.submittingWithdraw = false
					that.tui.toast(res.message)
				})
			},
			chooseLinkId(type,item){
				if(type == 'user'){
					this.linkId = this.balanceUser.id
				}else if(type == 'worker'){
					this.linkId = this.balanceWorker.workerId
				}else{
					this.linkId = item.id
				}
				this.searchForm.pageNum = 1
				if (!this.linkId) return
				this.rewardList();
			},
			formatMoney(value){
				const num = Number(value)
				if (!isFinite(num)) return '0.00'
				return num.toFixed(2)
			},
			amountClass(amount){
				return Number(amount) < 0 ? 'outcome' : 'income'
			},
			formatSignedAmount(amount){
				const num = Number(amount)
				if (!isFinite(num)) return '+0.00'
				const prefix = num < 0 ? '-' : '+'
				return prefix + Math.abs(num).toFixed(2)
			},
			flowIcon(title){
				const text = title || ''
				if (text.indexOf('提现') !== -1) return '提'
				if (text.indexOf('配送') !== -1) return '配'
				if (text.indexOf('商家') !== -1 || text.indexOf('结算') !== -1) return '商'
				if (text.indexOf('抽奖') !== -1 || text.indexOf('奖励') !== -1) return '奖'
				return '账'
			},
			rewardList(){
				this.loadStatus = 'loading'
				let that = this
				this.searchForm.linkUserId = this.linkId;
				that.tui.request("/mall/coupon/selectRewardByRegionId", "POST", this.searchForm, false, false).then((res) => {
					that.loadStatus = 'nomore';
					if (res.code == 200) {
						that.totalPages = res.result.pages
						if (that.searchForm.pageNum == 1) {
							that.rewardLists = res.result.records
						} else {
							that.rewardLists = [...that.rewardLists, ...res.result.records]
						}
						that.$forceUpdate()
					} else {
						that.tui.toast(res.message)
						return
					}
					uni.hideLoading()
				}).catch((res) => {})
			},
			back() {
				uni.navigateBack()
			}
		}
	
	}
</script>

<style lang="scss">
	page {
		width: 100%;
		min-height: 100%;
		font-size: 24rpx;
		background: #F8FCFB;
		color: #00231C;
	}
	
	.wallet-page {
		width: 100%;
		min-height: 100vh;
		position: relative;
		overflow: hidden;
		background:
			radial-gradient(circle at 50% 210rpx, rgba(255,255,255,0.78), rgba(255,255,255,0) 360rpx),
			linear-gradient(155deg, #F4FFF5 0%, #EAF8FF 44%, #F8FCFB 78%, #FFF8E4 100%);
	}

	.wallet-bg {
		position: absolute;
		top: 0;
		left: 0;
		right: 0;
		height: 980rpx;
		pointer-events: none;
		overflow: hidden;
		z-index: 0;
	}

	.wallet-aura {
		position: absolute;
		border-radius: 50%;
		filter: blur(4rpx);
		opacity: 0.78;
		animation: auraFloat 7s ease-in-out infinite alternate;
	}

	.aura-green {
		width: 520rpx;
		height: 520rpx;
		left: -190rpx;
		top: 240rpx;
		background: radial-gradient(circle, rgba(53,214,166,0.34), rgba(53,214,166,0));
	}

	.aura-blue {
		width: 560rpx;
		height: 560rpx;
		right: -210rpx;
		top: 40rpx;
		background: radial-gradient(circle, rgba(79,183,255,0.32), rgba(79,183,255,0));
		animation-delay: -2s;
	}

	.aura-yellow {
		width: 430rpx;
		height: 430rpx;
		right: -130rpx;
		top: 600rpx;
		background: radial-gradient(circle, rgba(255,221,112,0.28), rgba(255,221,112,0));
		animation-delay: -4s;
	}

	.wallet-nav {
		position: relative;
		z-index: 2;
		height: 128rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		padding-left: 20rpx;
		padding-right: 20rpx;
		box-sizing: content-box;
	}

	.back-btn{
		position: absolute;
		left: 20rpx;
		bottom: 20rpx;
		width: 72rpx;
		height: 72rpx;
		border-radius: 28rpx;
		background: rgba(255,255,255,0.72);
		box-shadow: 0 14rpx 34rpx rgba(50, 126, 112, 0.12);
		display: flex;
		align-items: center;
		justify-content: center;
		backdrop-filter: blur(14rpx);
	}

	.back-btn text {
		font-size: 54rpx;
		line-height: 54rpx;
		color: #173C35;
		transform: translateY(-2rpx);
	}

	.title-name{
		font-size: 38rpx;
		font-weight: 800;
		letter-spacing: 1rpx;
		color: #12342F;
	}

	.wallet-scroll {
		position: relative;
		z-index: 1;
		height: calc(100vh - 128rpx);
	}

	.wallet-content {
		padding: 18rpx 20rpx 0;
		position: relative;
		z-index: 1;
	}

	.wallet-tabs {
		position: relative;
		display: flex;
		padding: 8rpx;
		border-radius: 999rpx;
		background: rgba(255,255,255,0.58);
		box-shadow: inset 0 0 0 1rpx rgba(255,255,255,0.72), 0 16rpx 42rpx rgba(60, 130, 118, 0.11);
		backdrop-filter: blur(18rpx);
		margin-bottom: 24rpx;
		overflow: hidden;
	}

	.tab-slider {
		position: absolute;
		top: 8rpx;
		bottom: 8rpx;
		left: 8rpx;
		border-radius: 999rpx;
		background: linear-gradient(135deg, #DFFF85 0%, #8CFFE1 100%);
		box-shadow: 0 10rpx 26rpx rgba(46, 188, 147, 0.22);
		transition: transform 0.28s cubic-bezier(0.22, 0.8, 0.22, 1);
	}

	.wallet-tab {
		position: relative;
		z-index: 1;
		flex: 1;
		height: 70rpx;
		line-height: 70rpx;
		text-align: center;
		border-radius: 999rpx;
		font-size: 26rpx;
		font-weight: 700;
		color: rgba(18, 52, 47, 0.58);
		transition: color 0.2s ease, transform 0.2s ease;
	}

	.wallet-tab.active {
		color: #12342F;
		transform: scale(1.02);
	}

	.hero-card {
		position: relative;
		height: 220rpx;
		border-radius: 32rpx;
		padding: 32rpx;
		overflow: hidden;
		box-sizing: border-box;
		background: linear-gradient(135deg, rgba(222,255,214,0.88), rgba(255,247,188,0.78));
		box-shadow: 0 22rpx 54rpx rgba(58, 132, 115, 0.16);
		backdrop-filter: blur(18rpx);
	}

	.hero-card::before {
		content: '';
		position: absolute;
		right: -80rpx;
		top: -120rpx;
		width: 320rpx;
		height: 320rpx;
		border-radius: 50%;
		background: radial-gradient(circle, rgba(255,255,255,0.62), rgba(255,255,255,0));
	}

	.hero-worker {
		background: linear-gradient(135deg, rgba(212,249,255,0.9), rgba(224,255,203,0.82));
	}

	.hero-shop {
		background: linear-gradient(135deg, rgba(255,244,199,0.9), rgba(198,255,229,0.82));
	}

	.hero-copy {
		position: relative;
		z-index: 1;
	}

	.hero-label {
		font-size: 27rpx;
		font-weight: 700;
		color: rgba(18, 52, 47, 0.7);
	}

	.hero-amount {
		margin-top: 12rpx;
		font-size: 72rpx;
		line-height: 80rpx;
		font-weight: 900;
		letter-spacing: -1rpx;
		color: #102F29;
	}

	.hero-amount text {
		font-size: 34rpx;
		margin-right: 4rpx;
	}

	.hero-safe {
		margin-top: 8rpx;
		font-size: 24rpx;
		font-weight: 700;
		color: #21A875;
	}

	.hero-icon {
		position: absolute;
		right: 30rpx;
		top: 28rpx;
		width: 92rpx;
		height: 92rpx;
		border-radius: 34rpx;
		background: rgba(255,255,255,0.52);
		display: flex;
		align-items: center;
		justify-content: center;
		box-shadow: inset 0 0 0 1rpx rgba(255,255,255,0.68);
	}

	.hero-icon text {
		font-size: 24rpx;
		font-weight: 900;
		color: rgba(20, 68, 58, 0.64);
	}

	.withdraw-btn {
		position: absolute;
		right: 30rpx;
		bottom: 28rpx;
		min-width: 144rpx;
		height: 62rpx;
		line-height: 62rpx;
		text-align: center;
		border-radius: 999rpx;
		background: linear-gradient(135deg, #25D28E 0%, #72F0CE 100%);
		color: #FFFFFF;
		font-size: 26rpx;
		font-weight: 800;
		box-shadow: 0 14rpx 32rpx rgba(37, 210, 142, 0.28);
		transition: transform 0.16s ease;
	}

	.withdraw-btn:active,
	.popup-btn:active,
	.quick-item:active {
		transform: scale(0.96);
	}

	.shop-switch {
		display: flex;
		gap: 12rpx;
		overflow-x: auto;
		margin: 18rpx 0 0;
		padding-bottom: 2rpx;
	}

	.shop-pill {
		flex: 0 0 auto;
		padding: 16rpx 24rpx;
		border-radius: 999rpx;
		background: rgba(255,255,255,0.6);
		color: rgba(18, 52, 47, 0.62);
		font-size: 24rpx;
		font-weight: 700;
		box-shadow: 0 10rpx 28rpx rgba(55, 118, 107, 0.08);
	}

	.shop-pill.active {
		color: #12342F;
		background: linear-gradient(135deg, rgba(227,255,150,0.9), rgba(166,255,234,0.9));
	}

	.quick-grid {
		margin-top: 22rpx;
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: 16rpx;
	}

	.quick-item {
		height: 118rpx;
		border-radius: 24rpx;
		background: rgba(255,255,255,0.72);
		box-shadow: 0 16rpx 42rpx rgba(58, 132, 115, 0.1);
		display: flex;
		align-items: center;
		padding: 0 24rpx;
		box-sizing: border-box;
		backdrop-filter: blur(16rpx);
		transition: transform 0.18s ease;
	}

	.quick-icon {
		width: 64rpx;
		height: 64rpx;
		border-radius: 24rpx;
		margin-right: 18rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		color: #FFFFFF;
		font-size: 24rpx;
		font-weight: 900;
	}

	.quick-icon.green {
		background: linear-gradient(135deg, #25D28E, #9DF4B4);
	}

	.quick-icon.blue {
		background: linear-gradient(135deg, #5AB8FF, #A7F4FF);
	}

	.quick-icon.yellow {
		background: linear-gradient(135deg, #FFBC55, #FFE78D);
	}

	.quick-icon.purple {
		background: linear-gradient(135deg, #A38BFF, #F0C8FF);
	}

	.quick-name {
		font-size: 27rpx;
		font-weight: 800;
		color: #183B35;
	}

	.stats-grid {
		margin-top: 18rpx;
		display: grid;
		grid-template-columns: repeat(2, 1fr);
		gap: 16rpx;
	}

	.stat-card {
		min-height: 142rpx;
		border-radius: 24rpx;
		padding: 26rpx 24rpx;
		box-sizing: border-box;
		background: rgba(255,255,255,0.74);
		box-shadow: 0 16rpx 42rpx rgba(58, 132, 115, 0.1);
		backdrop-filter: blur(16rpx);
		transition: transform 0.18s ease, box-shadow 0.18s ease;
	}

	.stat-card:active {
		transform: translateY(-4rpx);
		box-shadow: 0 22rpx 48rpx rgba(58, 132, 115, 0.14);
	}

	.stat-label {
		font-size: 24rpx;
		font-weight: 700;
		color: rgba(18, 52, 47, 0.55);
	}

	.stat-value {
		margin-top: 14rpx;
		font-size: 34rpx;
		font-weight: 900;
		color: #12342F;
	}

	.section-head {
		margin-top: 26rpx;
		display: flex;
		align-items: flex-end;
		justify-content: space-between;
	}

	.section-kicker {
		font-size: 20rpx;
		font-weight: 900;
		color: rgba(37, 210, 142, 0.72);
		letter-spacing: 2rpx;
	}

	.section-title {
		margin-top: 4rpx;
		font-size: 32rpx;
		font-weight: 900;
		color: #12342F;
	}

	.timeline-list {
		margin-top: 16rpx;
	}

	.flow-card {
		min-height: 120rpx;
		border-radius: 24rpx;
		background: rgba(255,255,255,0.78);
		box-shadow: 0 14rpx 38rpx rgba(58, 132, 115, 0.09);
		backdrop-filter: blur(16rpx);
		display: flex;
		align-items: center;
		padding: 22rpx;
		box-sizing: border-box;
		margin-bottom: 12rpx;
	}

	.flow-icon {
		width: 70rpx;
		height: 70rpx;
		border-radius: 28rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		margin-right: 18rpx;
		color: #FFFFFF;
		font-size: 24rpx;
		font-weight: 900;
		box-shadow: 0 12rpx 26rpx rgba(58, 132, 115, 0.16);
	}

	.flow-icon.income {
		background: linear-gradient(135deg, #22CF8B, #A7F6BB);
	}

	.flow-icon.outcome {
		background: linear-gradient(135deg, #FF9A4B, #FFD97C);
	}

	.flow-main {
		flex: 1;
		min-width: 0;
	}

	.flow-title {
		font-size: 28rpx;
		font-weight: 800;
		color: #183B35;
	}

	.flow-time {
		margin-top: 8rpx;
		font-size: 22rpx;
		color: rgba(18, 52, 47, 0.45);
	}

	.flow-amount {
		margin-left: 16rpx;
		font-size: 30rpx;
		font-weight: 900;
	}

	.flow-amount.income {
		color: #20AD76;
	}

	.flow-amount.outcome {
		color: #F08B3A;
	}

	.empty-card {
		border-radius: 24rpx;
		background: rgba(255,255,255,0.62);
		box-shadow: 0 14rpx 38rpx rgba(58, 132, 115, 0.08);
		padding: 46rpx 24rpx;
		text-align: center;
		color: rgba(18, 52, 47, 0.48);
		font-weight: 700;
	}

	.withdraw-popup {
		width: 650rpx;
		border-radius: 36rpx 36rpx 0 0;
		padding: 34rpx 32rpx 46rpx;
		box-sizing: border-box;
		background: rgba(255,255,255,0.94);
		box-shadow: 0 -20rpx 60rpx rgba(43, 109, 96, 0.18);
		backdrop-filter: blur(20rpx);
	}

	.popup-title {
		font-size: 34rpx;
		font-weight: 900;
		color: #12342F;
		margin-bottom: 26rpx;
	}

	.popup-field {
		margin-bottom: 20rpx;
		padding: 20rpx 24rpx;
		border-radius: 24rpx;
		background: #F7FBFA;
	}

	.popup-field text {
		display: block;
		margin-bottom: 12rpx;
		font-size: 23rpx;
		font-weight: 700;
		color: rgba(18, 52, 47, 0.56);
	}

	.popup-field input {
		height: 54rpx;
		min-height: 54rpx;
		font-size: 28rpx;
		font-weight: 800;
		color: #12342F;
	}

	.popup-btn {
		margin-top: 28rpx;
		width: 100%;
		height: 96rpx;
		line-height: 96rpx;
		border-radius: 999rpx;
		text-align: center;
		font-size: 30rpx;
		font-weight: 900;
		color: #12342F;
		background: linear-gradient(90deg, rgba(227, 255, 150, 1), rgba(166, 255, 234, 1));
		box-shadow: 0 16rpx 34rpx rgba(37, 210, 142, 0.2);
		transition: transform 0.16s ease;
	}

	.enter-card {
		animation: cardIn 0.46s ease both;
	}

	.amount-roll {
		animation: amountPop 0.72s cubic-bezier(0.18, 0.82, 0.22, 1.1) both;
	}

	.bottom-space {
		height: 42rpx;
	}

	@keyframes cardIn {
		0% {
			opacity: 0;
			transform: translateY(22rpx);
		}
		100% {
			opacity: 1;
			transform: translateY(0);
		}
	}

	@keyframes amountPop {
		0% {
			opacity: 0;
			transform: translateY(16rpx) scale(0.96);
		}
		100% {
			opacity: 1;
			transform: translateY(0) scale(1);
		}
	}

	@keyframes auraFloat {
		0% {
			transform: translate3d(0, 0, 0) scale(1);
		}
		100% {
			transform: translate3d(18rpx, -18rpx, 0) scale(1.06);
		}
	}
</style>
