/*
 * 用户中心框架（BlueWhite）
 * 顶部 header#header 固定在最上方（样式在 custom.css，与官网页面共用）；
 * 侧边栏 #sidebarMenu 为通栏：顶部以下整列，随页面滚动保持不动（sticky），菜单过长时自己滚动；
 * 内容区随整个页面滚动（不再是 #main-body 内部滚动）。
 * 手机（≤800px）：侧边栏变成左侧抽屉，底部导航 .dv-tabbar 固定在最下方，产品 / 自助服务 / 工单 / 我的从底部弹出面板。
 * 结构：section#main-body > .page-container > (nav#sidebarMenu.page-side + .page-body > .main-container)
 */
:root {
	--dv-header-h: 70px;
	--dv-side-w: 200px;
	--dv-tabbar-h: 56px;
}

/* ---------- 框架 ---------- */
section#main-body {
	width: 100%;
	height: auto;
	margin-top: var(--dv-header-h);
	padding: 0;
	overflow: visible;
}
.page-container {
	position: relative;
	display: flex;
	flex-direction: row;
	align-items: flex-start;
	min-height: calc(100vh - var(--dv-header-h));
}
.page-side {
	position: sticky;
	top: var(--dv-header-h);
	z-index: 90;
	display: flex;
	flex-direction: column;
	flex: 0 0 var(--dv-side-w);
	width: var(--dv-side-w);
	height: calc(100vh - var(--dv-header-h));
}
.page-body {
	box-sizing: border-box;
	display: flex;
	flex: 1 1 0%;
	flex-direction: column;
	width: 100%;
	min-width: 0;
	min-height: calc(100vh - var(--dv-header-h));
}
.main-container {
	padding: 1.5rem 1rem;
}
.dv-backdrop {
	display: none;
}

/* Sidebar (方案 A · 圆角胶囊) */
.sidebar-sticky {
	height: 100%;
	padding: 16px 10px;
	background-color: #1b1f2a;
	overflow-y: auto;
}
.sidebar-sticky .nav {
	margin-bottom: 6px;
}
.sidebar-sticky .nav-title {
	padding: 16px 12px 6px;
	color: #6b7686;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .06em;
}
.sidebar-sticky .nav-link {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 2px 0;
	padding: 8px 12px;
	border-radius: 8px;
	color: #b8bfca;
	font-size: 14px;
	transition: background-color .15s, color .15s;
}
.sidebar-sticky .nav-link i {
	width: 20px;
	color: #7d8796;
	font-size: 18px;
	text-align: center;
	transition: color .15s;
}
.sidebar-sticky .nav-link span:first-child {
	flex: 1;
}
.sidebar-sticky .nav-link:hover {
	color: #e5e7eb;
	background-color: rgba(255, 255, 255, .05);
}
.sidebar-sticky .nav-link.active {
	color: #FFF;
	font-weight: 500;
	background-color: rgba(59, 130, 246, .16);
}
.sidebar-sticky .nav-link.active::before {
	content: "";
	position: absolute;
	left: -10px;
	top: 8px;
	bottom: 8px;
	width: 3px;
	border-radius: 0 3px 3px 0;
	background-color: #3b82f6;
}
.sidebar-sticky .nav-link.active i {
	color: #60a5fa;
}
.sidebar-sticky .nav-link:focus-visible {
	outline: 2px solid #3b82f6;
	outline-offset: -2px;
}

.side-white .sidebar-sticky {
	background-color: #FFF;
	border-right: 1px solid #eef0f4;
}
.side-white .sidebar-sticky .nav-title {
	color: #9aa3af;
}
.side-white .sidebar-sticky .nav-link {
	color: #374151;
}
.side-white .sidebar-sticky .nav-link i {
	color: #8b95a3;
}
.side-white .sidebar-sticky .nav-link:not(.active):hover {
	color: #111827;
	background-color: #f3f5f8;
}
.side-white .sidebar-sticky .nav-link.active {
	color: var(--primary);
	background-color: #eef4ff;
}
.side-white .sidebar-sticky .nav-link.active i {
	color: var(--primary);
}
.side-white .sidebar-sticky .nav-link.active::before {
	background-color: var(--primary);
}
.side-white .sidebar-sticky .nav-link:focus-visible {
	outline-color: var(--primary);
}

.sidebar-sticky {
	overscroll-behavior: contain;
}

/* ---------- 手机：侧边栏抽屉 + 底部导航 ---------- */
.dv-tabbar,
.dv-sheet,
.dv-sheet-backdrop {
	display: none;
}
@media (max-width: 800px) {
	/* 侧边栏样式不变，只是改成从左侧滑出：位置在顶部下方，宽度与电脑端相同 */
	.page-side {
		position: fixed;
		top: var(--dv-header-h);
		bottom: 0;
		left: 0;
		z-index: 1060;
		height: auto;
		visibility: hidden;
		transform: translateX(-100%);
		transition: transform .2s ease, visibility 0s linear .2s;
	}
	body.dv-drawer-open .page-side {
		visibility: visible;
		transform: translateX(0);
		transition: transform .2s ease;
	}
	body.dv-drawer-open {
		overflow: hidden;
	}
	.dv-backdrop {
		position: fixed;
		inset: var(--dv-header-h) 0 0 0;
		z-index: 1050;
		display: block;
		background-color: rgba(15, 23, 42, .5);
	}
	.dv-backdrop[hidden] {
		display: none;
	}
	@media (prefers-reduced-motion: reduce) {
		.page-side,
		body.dv-drawer-open .page-side {
			transition: none;
		}
	}

	/* 内容底部留出底部导航的高度 */
	.dv-console .page-body {
		padding-bottom: calc(var(--dv-tabbar-h) + env(safe-area-inset-bottom, 0px));
	}
	/* 底部导航：首页 / 产品 / 自助服务 / 工单 / 我的 */
	.dv-tabbar {
		position: fixed;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 1000;
		display: grid;
		grid-template-columns: repeat(5, minmax(0, 1fr));
		height: calc(var(--dv-tabbar-h) + env(safe-area-inset-bottom, 0px));
		padding: 0 4px env(safe-area-inset-bottom, 0px);
		background: rgba(255, 255, 255, .96);
		-webkit-backdrop-filter: saturate(180%) blur(12px);
		backdrop-filter: saturate(180%) blur(12px);
		border-top: 1px solid #e8ebf0;
	}
	.dv-tab {
		position: relative;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 3px;
		min-width: 0;
		padding: 0;
		border: 0;
		background: transparent;
		color: #8a93a2;
		font: inherit;
		font-size: 11px;
		line-height: 1.2;
		text-decoration: none;
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}
	.dv-tab i {
		font-size: 21px;
		line-height: 1;
	}
	.dv-tab:hover,
	.dv-tab:focus {
		color: #5e6673;
		text-decoration: none;
	}
	.dv-tab.is-active,
	.dv-tab[aria-expanded="true"] {
		color: var(--primary);
		font-weight: 600;
	}
	.dv-tab.is-active::before {
		content: "";
		position: absolute;
		top: 0;
		left: 50%;
		width: 20px;
		height: 3px;
		border-radius: 0 0 3px 3px;
		background: var(--primary);
		transform: translateX(-50%);
	}
	.dv-tab:focus-visible {
		outline: 2px solid var(--primary);
		outline-offset: -4px;
		border-radius: 8px;
	}

	/* 底部弹出面板 */
	.dv-sheet-backdrop {
		position: fixed;
		inset: 0;
		z-index: 1070;
		display: block;
		background: rgba(15, 23, 42, .45);
	}
	.dv-sheet-backdrop[hidden] {
		display: none;
	}
	.dv-sheet {
		position: fixed;
		right: 0;
		bottom: 0;
		left: 0;
		z-index: 1080;
		display: block;
		max-height: 80vh;
		max-height: 80dvh;
		overflow-y: auto;
		overscroll-behavior: contain;
		padding: 6px 16px calc(16px + env(safe-area-inset-bottom, 0px));
		border-radius: 16px 16px 0 0;
		background: #f5f7fa;
		box-shadow: 0 -12px 40px rgba(15, 23, 42, .18);
		animation: dv-sheet-up .22s ease-out;
	}
	.dv-sheet[hidden] {
		display: none;
	}
	.dv-sheet::before {
		content: "";
		display: block;
		width: 36px;
		height: 4px;
		margin: 2px auto 6px;
		border-radius: 2px;
		background: #d5dae1;
	}
	@keyframes dv-sheet-up {
		from { transform: translateY(24px); opacity: 0; }
	}
	.dv-sheet-head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-bottom: 10px;
	}
	.dv-sheet-head h2 {
		margin: 0;
		color: #1f2933;
		font-size: 16px;
		font-weight: 600;
	}
	.dv-sheet-close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 36px;
		height: 36px;
		margin-right: -8px;
		border: 0;
		border-radius: 50%;
		background: transparent;
		color: #6b7585;
		font-size: 16px;
	}
	.dv-sheet-close:hover {
		background: #e9edf2;
	}
	.dv-sheet-grid {
		display: grid;
		grid-template-columns: repeat(4, minmax(0, 1fr));
		gap: 10px;
	}
	.dv-sheet-item {
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 8px;
		min-width: 0;
		padding: 14px 4px 12px;
		border-radius: 12px;
		background: #fff;
		color: #303a46;
		font-size: 12px;
		text-align: center;
		text-decoration: none;
	}
	.dv-sheet-item:hover,
	.dv-sheet-item:focus {
		color: #1f2933;
		text-decoration: none;
	}
	.dv-sheet-icon {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 40px;
		height: 40px;
		border-radius: 12px;
		background: #eef4ff;
		color: var(--primary);
		font-size: 20px;
	}
	.dv-sheet-item.is-active {
		color: var(--primary);
		font-weight: 600;
		box-shadow: inset 0 0 0 1.5px var(--primary);
	}
	.dv-sheet-item.is-active .dv-sheet-icon {
		background: var(--primary);
		color: #fff;
	}
	.dv-sheet-label {
		margin: 14px 4px 6px;
		color: #8a93a2;
		font-size: 12px;
	}
	.dv-sheet-list {
		overflow: hidden;
		border-radius: 12px;
		background: #fff;
	}
	.dv-sheet-row {
		display: flex;
		align-items: center;
		gap: 12px;
		min-height: 48px;
		padding: 0 14px;
		color: #303a46;
		font-size: 14px;
		text-decoration: none;
	}
	.dv-sheet-row + .dv-sheet-row {
		border-top: 1px solid #f0f2f5;
	}
	.dv-sheet-row > i:first-child {
		width: 20px;
		color: #6b7585;
		font-size: 17px;
		text-align: center;
	}
	.dv-sheet-row > span {
		flex: 1;
	}
	.dv-sheet-row > i:last-child {
		color: #c2c8d0;
		font-size: 12px;
	}
	.dv-sheet-row:hover,
	.dv-sheet-row:focus {
		color: #1f2933;
		background: #f8fafc;
		text-decoration: none;
	}
	.dv-sheet-row.is-active,
	.dv-sheet-row.is-active > i:first-child {
		color: var(--primary);
		font-weight: 600;
	}
	.dv-sheet-balance {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 14px 16px;
		border-radius: 12px;
		background: linear-gradient(135deg, #0453d9, #2f7bff);
		color: #fff;
		text-decoration: none;
	}
	.dv-sheet-balance:hover,
	.dv-sheet-balance:focus {
		color: #fff;
		text-decoration: none;
	}
	.dv-sheet-balance small {
		display: block;
		opacity: .8;
		font-size: 12px;
	}
	.dv-sheet-balance b {
		font-size: 22px;
		font-weight: 600;
	}
	.dv-sheet-balance-btn {
		padding: 6px 14px;
		border-radius: 999px;
		background: rgba(255, 255, 255, .2);
		font-size: 13px;
	}
	.dv-sheet-logout {
		display: flex;
		align-items: center;
		justify-content: center;
		gap: 8px;
		min-height: 46px;
		margin-top: 14px;
		border-radius: 12px;
		background: #fff;
		color: #b42318;
		font-size: 14px;
		text-decoration: none;
	}
	.dv-sheet-logout:hover,
	.dv-sheet-logout:focus {
		color: #912018;
		text-decoration: none;
	}
	body.dv-sheet-open {
		overflow: hidden;
	}
	@media (prefers-reduced-motion: reduce) {
		.dv-sheet {
			animation: none;
		}
	}
}
