/* ============================================================
   XYY Mobile Layout v3.9 — 移动端独立 App 式布局（与 PC 侧栏布局区分）
   ============================================================ */

@media (max-width: 992px) {
	:root {
		--xyy-tabbar-h: 0px;
		--xyy-mobile-gap: 10px;
	}

	/* ===== 全局：App 壳层（无底部导航） ===== */
	body.xyy-theme.xyy-mobile-app {
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}

	body.xyy-theme.xyy-mobile-app .main-content {
		margin-left: 0 !important;
	}

	body.xyy-theme.xyy-mobile-app .page-content {
		padding: 12px 12px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
	}

	body.xyy-theme.xyy-mobile-app .container-fluid {
		padding-left: 0 !important;
		padding-right: 0 !important;
	}

	/* 隐藏页脚，底部导航替代 */
	body.xyy-theme.xyy-mobile-app .footer {
		display: none !important;
	}

	/* ===== 顶栏：精简 App 风格 ===== */
	body.xyy-theme.xyy-mobile-app #page-topbar {
		background: rgba(15, 10, 35, 0.72) !important;
		backdrop-filter: blur(16px) saturate(140%);
		-webkit-backdrop-filter: blur(16px) saturate(140%);
		border-bottom: 1px solid rgba(255, 255, 255, 0.08);
		box-shadow: none !important;
	}

	body.xyy-theme.xyy-mobile-app #page-topbar .navbar-header {
		justify-content: space-between;
	}

	body.xyy-theme.xyy-mobile-app #page-topbar .navbar-header > .d-flex:first-child {
		flex: 0 1 auto;
	}

	body.xyy-theme.xyy-mobile-app #vertical-menu-btn {
		order: 2;
		margin-left: auto;
		border-radius: 10px;
		background: rgba(255, 255, 255, 0.08) !important;
	}

	body.xyy-theme.xyy-mobile-app #page-topbar .navbar-brand-box {
		padding-left: 12px !important;
	}

	/* ===== 页头：紧凑标题栏 ===== */
	body.xyy-theme.xyy-mobile-app .page-title-box {
		background: rgba(255, 255, 255, 0.06);
		border: 1px solid rgba(255, 255, 255, 0.1);
		border-radius: 14px;
		padding: 12px 14px !important;
		margin-bottom: 12px !important;
		flex-direction: row !important;
		align-items: center !important;
		gap: 10px;
	}

	body.xyy-theme.xyy-mobile-app .page-title-box h4 {
		font-size: 16px !important;
		font-weight: 600;
		margin: 0 !important;
		flex: 1;
		min-width: 0;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	body.xyy-theme.xyy-mobile-app .page-title-right,
	body.xyy-theme.xyy-mobile-app .breadcrumb {
		display: none !important;
	}

	body.xyy-theme.xyy-mobile-app .xyy-mobile-back {
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		width: 32px;
		height: 32px;
		border-radius: 10px;
		background: rgba(255, 255, 255, 0.1);
		flex-shrink: 0;
		margin-right: 4px;
	}

	body.xyy-theme.xyy-mobile-app .xyy-mobile-back i {
		font-size: 22px !important;
		margin: 0 !important;
		color: #fff !important;
	}

	/* 用户中心首页：无页头，直接内容 */
	body.xyy-theme.xyy-mobile-app.xyy-page-clientarea .page-content {
		padding-top: calc(var(--xyy-topbar-h) + 8px + env(safe-area-inset-top, 0px)) !important;
	}

	/* ===== 卡片：全宽 App 块 ===== */
	body.xyy-theme.xyy-mobile-app .card {
		border-radius: 16px !important;
		margin-bottom: var(--xyy-mobile-gap) !important;
		border: 1px solid rgba(255, 255, 255, 0.1) !important;
		box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15) !important;
	}

	body.xyy-theme.xyy-mobile-app .card-body {
		padding: 16px !important;
	}

	body.xyy-theme.xyy-mobile-app .card .card-body.p-0 {
		padding: 0 !important;
	}

	/* ===== 底部 Tab 导航（已禁用） ===== */
	.xyy-mobile-tabbar {
		display: none !important;
	}

	/* ===== 用户中心首页：Dashboard 布局 ===== */
	body.xyy-theme.xyy-mobile-app .xyy-clientarea-home {
		display: flex;
		flex-direction: column;
		gap: var(--xyy-mobile-gap);
		margin: 0 !important;
	}

	body.xyy-theme.xyy-mobile-app .xyy-clientarea-home > section {
		order: 10;
		padding: 0 !important;
		margin: 0 !important;
		max-width: 100% !important;
		flex: none !important;
	}

	/* 1. 个人信息 hero */
	body.xyy-theme.xyy-mobile-app .xyy-clientarea-home > section:nth-child(1) {
		order: 1;
	}

	body.xyy-theme.xyy-mobile-app .xyy-clientarea-home > section:nth-child(1) .card {
		background: linear-gradient(135deg, rgba(167, 139, 250, 0.18), rgba(139, 92, 246, 0.08)) !important;
	}

	body.xyy-theme.xyy-mobile-app .xyy-clientarea-home > section:nth-child(1) .xyy-profile-divider {
		margin: 12px 14px;
	}

	body.xyy-theme.xyy-mobile-app .xyy-clientarea-home > section:nth-child(1) .xyy-profile-stats {
		display: grid !important;
		grid-template-columns: repeat(3, 1fr);
		gap: 8px;
		padding: 4px 12px 12px;
	}

	body.xyy-theme.xyy-mobile-app .xyy-clientarea-home > section:nth-child(1) .xyy-profile-stats > a,
	body.xyy-theme.xyy-mobile-app .xyy-clientarea-home > section:nth-child(1) .xyy-profile-stats > div {
		background: rgba(255, 255, 255, 0.08);
		border-radius: 12px;
		padding: 10px 6px;
		text-align: center;
		font-size: 11px;
	}

	body.xyy-theme.xyy-mobile-app .xyy-clientarea-home > section:nth-child(1) .xyy-profile-stats .text-center {
		font-size: 18px !important;
		font-weight: 700;
		margin-bottom: 2px;
	}

	/* 2. 财务 */
	body.xyy-theme.xyy-mobile-app .xyy-clientarea-home > section:nth-child(2) {
		order: 2;
	}

	body.xyy-theme.xyy-mobile-app .xyy-clientarea-home > section:nth-child(2) .d-flex.h100p {
		flex-direction: column !important;
		gap: 12px;
	}

	body.xyy-theme.xyy-mobile-app .xyy-clientarea-home > section:nth-child(2) #balanceCharts {
		height: 140px !important;
		min-height: 140px !important;
	}

	body.xyy-theme.xyy-mobile-app .xyy-clientarea-home > section:nth-child(2) .btn.w-50 {
		width: 100% !important;
		margin-top: 12px !important;
	}

	/* 3. 产品快捷入口 */
	body.xyy-theme.xyy-mobile-app .xyy-clientarea-home > section:nth-child(3) {
		order: 3;
	}

	body.xyy-theme.xyy-mobile-app .user-center_product_grid {
		display: grid !important;
		grid-template-columns: repeat(2, 1fr) !important;
		gap: 8px !important;
		max-height: none !important;
	}

	body.xyy-theme.xyy-mobile-app .user-center_product {
		border-radius: 12px !important;
		padding: 12px !important;
		background: rgba(255, 255, 255, 0.06) !important;
	}

	/* 4. 资源列表 */
	body.xyy-theme.xyy-mobile-app .xyy-clientarea-home > section:nth-child(4) {
		order: 4;
	}

	/* 5. 公告 */
	body.xyy-theme.xyy-mobile-app .xyy-clientarea-home > section:nth-child(5) {
		order: 5;
	}

	/* ===== 消息中心：独立移动端 UI ===== */
	body.xyy-theme.xyy-mobile-app.xyy-page-message .card > .card-body {
		padding: 0 !important;
		overflow: hidden;
	}

	body.xyy-theme.xyy-mobile-app.xyy-page-message .table-container {
		display: flex;
		flex-direction: column;
	}

	/* 分类 Tab → 横向胶囊 */
	body.xyy-theme.xyy-mobile-app.xyy-page-message .table-header {
		padding: 12px 12px 8px !important;
		border-bottom: none !important;
		background: transparent !important;
	}

	body.xyy-theme.xyy-mobile-app.xyy-page-message .table-header .nav-tabs {
		flex-wrap: nowrap;
		overflow-x: auto;
		border: none;
		gap: 8px;
		padding-bottom: 4px;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}

	body.xyy-theme.xyy-mobile-app.xyy-page-message .table-header .nav-tabs::-webkit-scrollbar {
		display: none;
	}

	body.xyy-theme.xyy-mobile-app.xyy-page-message .table-header .nav-item {
		flex-shrink: 0;
	}

	body.xyy-theme.xyy-mobile-app.xyy-page-message .table-header .nav-link {
		border: 1px solid rgba(255, 255, 255, 0.18) !important;
		border-radius: 20px !important;
		padding: 6px 14px !important;
		font-size: 13px !important;
		color: rgba(255, 255, 255, 0.75) !important;
		background: rgba(255, 255, 255, 0.06) !important;
		margin: 0 !important;
		white-space: nowrap;
	}

	body.xyy-theme.xyy-mobile-app.xyy-page-message .table-header .nav-link.active {
		background: linear-gradient(135deg, #a78bfa, #8b5cf6) !important;
		border-color: transparent !important;
		color: #fff !important;
		font-weight: 600;
	}

	/* 表格 → 卡片列表 */
	body.xyy-theme.xyy-mobile-app .xyy-table-as-cards {
		border: none !important;
		overflow: visible !important;
		padding: 0 12px 12px;
	}

	body.xyy-theme.xyy-mobile-app .xyy-table-as-cards .tablelist {
		min-width: 0 !important;
		border-collapse: separate;
		border-spacing: 0 8px;
	}

	body.xyy-theme.xyy-mobile-app .xyy-table-as-cards .tablelist thead {
		display: none;
	}

	body.xyy-theme.xyy-mobile-app .xyy-table-as-cards .tablelist tbody tr {
		display: block;
		position: relative;
		background: rgba(255, 255, 255, 0.08);
		border: 1px solid rgba(255, 255, 255, 0.1);
		border-radius: 14px;
		padding: 14px 14px 14px 44px;
		margin-bottom: 0;
	}

	body.xyy-theme.xyy-mobile-app .xyy-table-as-cards .tablelist tbody tr:has(.no-data) {
		padding: 14px;
		text-align: center;
	}

	body.xyy-theme.xyy-mobile-app .xyy-table-as-cards .tablelist td {
		display: block;
		border: none !important;
		padding: 0 !important;
		background: transparent !important;
	}

	body.xyy-theme.xyy-mobile-app .xyy-table-as-cards .tablelist td:first-child {
		position: absolute;
		left: 12px;
		top: 50%;
		transform: translateY(-50%);
		width: auto;
	}

	body.xyy-theme.xyy-mobile-app .xyy-table-as-cards .tablelist td:nth-child(2) {
		font-size: 14px;
		font-weight: 500;
		line-height: 1.45;
		margin-bottom: 8px;
		color: #f8fafc;
	}

	body.xyy-theme.xyy-mobile-app .xyy-table-as-cards .tablelist td:nth-child(3),
	body.xyy-theme.xyy-mobile-app .xyy-table-as-cards .tablelist td:nth-child(4) {
		display: inline-block;
		font-size: 12px;
		color: rgba(255, 255, 255, 0.55);
		margin-right: 12px;
	}

	body.xyy-theme.xyy-mobile-app .xyy-table-as-cards .tablelist td:nth-child(4)::before {
		content: '· ';
	}

	body.xyy-theme.xyy-mobile-app .xyy-table-as-cards .no-data {
		padding: 32px 0;
		font-size: 14px;
		color: rgba(255, 255, 255, 0.45);
	}

	/* 分页紧凑 */
	body.xyy-theme.xyy-mobile-app.xyy-page-message .table-footer {
		padding: 8px 12px 12px !important;
		border-top: 1px solid rgba(255, 255, 255, 0.08);
	}

	body.xyy-theme.xyy-mobile-app.xyy-page-message .table-pageinfo {
		font-size: 12px;
		text-align: center;
	}

	body.xyy-theme.xyy-mobile-app.xyy-page-message .table-pageinfo select {
		font-size: 12px;
		padding: 2px 6px;
		border-radius: 6px;
		background: rgba(255, 255, 255, 0.1);
		border: 1px solid rgba(255, 255, 255, 0.15);
		color: #fff;
	}

	/* 操作按钮：固定底栏 */
	body.xyy-theme.xyy-mobile-app .xyy-mobile-action-bar {
		position: fixed;
		left: 0;
		right: 0;
		bottom: env(safe-area-inset-bottom, 0px);
		z-index: 1002;
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
		padding: 10px 12px;
		background: rgba(12, 8, 28, 0.92);
		backdrop-filter: blur(16px);
		-webkit-backdrop-filter: blur(16px);
		border-top: 1px solid rgba(255, 255, 255, 0.1);
	}

	body.xyy-theme.xyy-mobile-app .xyy-mobile-action-bar .btn {
		flex: 1 1 calc(50% - 4px);
		min-width: 0;
		margin: 0 !important;
		font-size: 13px;
		padding: 10px 8px;
		border-radius: 10px;
	}

	body.xyy-theme.xyy-mobile-app.xyy-page-message .page-content {
		padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important;
	}

	/* 有操作栏的页面隐藏原按钮区占位 */
	body.xyy-theme.xyy-mobile-app .xyy-mobile-action-bar-source {
		display: none !important;
	}

	/* ===== 通用列表页表格卡片化 ===== */
	body.xyy-theme.xyy-mobile-app .table-container .table-responsive:not(.xyy-no-card-list) {
		border: none !important;
	}

	/* ===== 侧栏：全屏抽屉 ===== */
	body.xyy-theme.xyy-mobile-app .vertical-menu {
		width: min(300px, 88vw) !important;
	}

	body.xyy-theme.xyy-mobile-app .xyy-sidebar-brand {
		padding: 16px;
		text-align: center;
		border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	}

	/* ===== 模态框全屏化 ===== */
	body.xyy-theme.xyy-mobile-app .modal-dialog {
		margin: 0;
		max-width: 100%;
		min-height: 100dvh;
		display: flex;
		align-items: flex-end;
	}

	body.xyy-theme.xyy-mobile-app .modal-content {
		border-radius: 20px 20px 0 0 !important;
		max-height: 85dvh;
		overflow-y: auto;
	}

	body.xyy-theme.xyy-mobile-app.xyy-page-message .bs-example-modal-lg .modal-dialog {
		align-items: flex-end;
	}
}

@media (max-width: 576px) {
	:root {
		--xyy-tabbar-h: 0px;
	}
}

/* PC 端隐藏移动端专用元素 */
@media (min-width: 993px) {
	.xyy-mobile-tabbar,
	.xyy-mobile-action-bar {
		display: none !important;
	}
}
