/*
 * public/styles.css
 * 职责：全局样式。樱花夜空主题 —— 毛玻璃卡片 + 粉紫青渐变光斑 + 星点纹理。
 * 设计要点：
 *  - 所有浮层（卡片/顶栏/模态框/Toast）统一 backdrop-filter 玻璃质感
 *  - 背景由多层径向渐变光斑构成，为玻璃提供可模糊的彩色底
 *  - 动效克制：只在 hover / 状态变化处使用，且遵循 prefers-reduced-motion
 */

:root {
	/* 夜空底色 */
	--bg-0: #0d0819;
	--bg-1: #170e2b;
	--bg-2: #1f1438;

	/* 二次元主色：樱花粉 / 薰衣草紫 / 青空蓝 */
	--pink: #ff8ec7;
	--pink-soft: #ffb3d9;
	--pink-deep: #f472b6;
	--violet: #a78bfa;
	--violet-deep: #8b5cf6;
	--cyan: #7dd3fc;
	--mint: #6ee7b7;
	--gold: #fcd34d;
	--danger: #fb7185;

	/* 文本 */
	--text: #f7f2ff;
	--text-dim: #c6b8e4;
	--text-faint: #9481b8;

	/* 玻璃层 */
	--glass: rgba(255, 255, 255, 0.07);
	--glass-strong: rgba(255, 255, 255, 0.12);
	--glass-border: rgba(255, 255, 255, 0.16);
	--glass-hi: rgba(255, 255, 255, 0.30);

	/* 圆角 */
	--radius: 20px;
	--radius-sm: 13px;
	--radius-xs: 10px;

	/* 阴影与光晕 */
	--shadow-soft: 0 8px 32px rgba(6, 2, 18, 0.45);
	--glow-pink: 0 8px 26px rgba(255, 142, 199, 0.32);
	--glow-violet: 0 8px 26px rgba(167, 139, 250, 0.30);

	--font: 'PingFang SC', 'HarmonyOS Sans SC', 'MiSans', 'Microsoft YaHei UI', 'Microsoft YaHei', system-ui, sans-serif;
	--mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;

	/* 弹簧曲线，用于二次元感的回弹 */
	--spring: cubic-bezier(0.34, 1.56, 0.64, 1);

	/* ---- 旧变量名兼容层：部分视图仍以内联样式引用，避免换肤后失效 ---- */
	--bg: var(--bg-0);
	--bg-soft: rgba(255, 255, 255, 0.05);
	--bg-card: rgba(255, 255, 255, 0.07);
	--bg-hover: rgba(255, 255, 255, 0.13);
	--border: rgba(255, 255, 255, 0.16);
	--ok: var(--mint);
	--warn: var(--gold);
	--accent: var(--pink);
	--accent-strong: var(--pink-deep);
	--accent-glow: rgba(255, 142, 199, 0.35);
	--shadow: var(--shadow-soft);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* 底色放在 html（canvas 层）；body 保持透明，
   否则 body 的背景会盖住 z-index 为负的随机背景层 */
html {
	height: 100%;
	background: var(--bg-0);
}

body {
	min-height: 100%;
	color: var(--text);
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.6;
	background: transparent;
}

/* ---------- 背景：随机 SVG 图层 + 兜底底色 ---------- */

/* 兜底：JS 未执行时仍有一层完整的夜空底色 */
body::before {
	content: '';
	position: fixed;
	inset: 0;
	z-index: -2;
	pointer-events: none;
	background:
		radial-gradient(46% 38% at 14% 10%, rgba(255, 142, 199, 0.34), transparent 70%),
		radial-gradient(42% 36% at 86% 6%, rgba(167, 139, 250, 0.32), transparent 70%),
		radial-gradient(54% 44% at 82% 88%, rgba(125, 211, 252, 0.24), transparent 70%),
		linear-gradient(165deg, #150d28 0%, #1c1236 46%, #0d0819 100%);
}

/* 随机背景层（由 background.js 注入） */
.bg-art {
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	overflow: hidden;
}
.bg-art svg { width: 100%; height: 100%; display: block; }

/* 照片背景：独立图层做模糊，遮罩层保持清晰以免糊掉渐变 */
.bg-art.is-photo::before {
	content: '';
	position: absolute;
	inset: -3%;
	background-image: var(--bg-url);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
	filter: blur(3px) saturate(1.12) brightness(0.64);
	animation: bgFadeIn 0.9s ease both;
}

/* 暗化遮罩：保证前景文字对比度，同时让毛玻璃有色彩可透 */
.bg-art.is-photo::after {
	content: '';
	position: absolute;
	inset: 0;
	background: linear-gradient(
		160deg,
		rgba(11, 7, 22, 0.66) 0%,
		rgba(11, 7, 22, 0.34) 42%,
		rgba(11, 7, 22, 0.80) 100%
	);
	animation: bgFadeIn 0.9s ease both;
}

@keyframes bgFadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

.bg-star { animation: starTwinkle 4.2s ease-in-out infinite alternate; }
@keyframes starTwinkle {
	from { opacity: 0.22; }
	to { opacity: 0.95; }
}

.bg-orb { animation: orbBreath 16s ease-in-out infinite alternate; transform-origin: center; }
@keyframes orbBreath {
	from { opacity: 0.82; }
	to { opacity: 1; }
}

.bg-orb-sub { animation: starTwinkle 6s ease-in-out infinite alternate; }

#app { min-height: 100%; display: flex; flex-direction: column; }

a { color: var(--pink-soft); text-decoration: none; }
a:hover { text-decoration: underline; }

button { font-family: inherit; }

::selection { background: rgba(255, 142, 199, 0.38); color: #fff; }

/* 滚动条：粉紫渐变胶囊 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
	background: linear-gradient(180deg, rgba(255, 142, 199, 0.55), rgba(167, 139, 250, 0.55));
	border: 2px solid transparent;
	background-clip: padding-box;
	border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
	background: linear-gradient(180deg, rgba(255, 142, 199, 0.8), rgba(167, 139, 250, 0.8));
	background-clip: padding-box;
}

/* ---------- 玻璃基类（多组件共用） ---------- */

.card,
.device-card,
.stat-card,
.settings-card,
.table-wrap,
.modal,
.auth-card {
	background: linear-gradient(150deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.055));
	backdrop-filter: blur(38px) saturate(205%) brightness(1.06);
	-webkit-backdrop-filter: blur(38px) saturate(205%) brightness(1.06);
	border: 1px solid var(--glass-border);
	/* inset 描边在元素内部，mask 裁剪后圆角处依然连续（border 会被抗锯齿吃掉） */
	box-shadow:
		inset 0 0 0 1px rgba(255, 255, 255, 0.22),
		inset 0 1px 0 rgba(255, 255, 255, 0.30),
		var(--shadow-soft);
}

/* 不支持毛玻璃时退化为深色实底，保证可读性 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
	.card, .device-card, .stat-card, .settings-card, .table-wrap, .modal, .auth-card, .topbar {
		background: rgba(28, 18, 52, 0.94);
	}
}

/* 玻璃顶部高光线：让面板有「被光扫过」的二次元质感 */
.card, .stat-card, .settings-card, .table-wrap, .auth-card, .modal, .device-card { position: relative; }
.card::after,
.stat-card::after,
.settings-card::after,
.table-wrap::after,
.auth-card::after,
.modal::after,
.device-card::after {
	content: '';
	position: absolute;
	top: 0;
	left: 14%;
	right: 14%;
	height: 1px;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.62), transparent);
	pointer-events: none;
	opacity: 0.7;
}

/* 页面区块入场 */
.page-header { animation: pageIn 0.3s ease both; }
.device-grid, .table-wrap, .settings-grid, .stats-row { animation: pageIn 0.38s ease both; }
@keyframes pageIn {
	from { opacity: 0; transform: translateY(9px); }
	to { opacity: 1; transform: none; }
}

/* ---------- 连续曲率圆角 ----------
 * 由 public/js/squircle.js 按元素实际尺寸动态生成 SVG mask 实现。
 * 不使用 CSS 原生 corner-shape：实测 Chrome 131 会把 superellipse(4) 渲染成近乎直角，
 * 曲率方向与预期相反，视觉上比普通圆角更差。
 * 未加载 JS 时自动退化为普通 border-radius，不影响可用性。
 */

/* ---------- 按钮 ---------- */

/* ---------- 按钮 ---------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 9px 18px;
	border-radius: var(--radius-xs);
	border: 1px solid var(--glass-border);
	background: linear-gradient(150deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.045));
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	color: var(--text);
	font-size: 14px;
	cursor: pointer;
	user-select: none;
	white-space: nowrap;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
	transition: transform 0.18s var(--spring), box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}
.btn:hover {
	background: linear-gradient(150deg, rgba(255, 255, 255, 0.17), rgba(255, 255, 255, 0.07));
	border-color: rgba(255, 142, 199, 0.5);
	transform: translateY(-1px);
	box-shadow: 0 6px 20px rgba(255, 142, 199, 0.22);
}
.btn:active { transform: translateY(0) scale(0.985); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary {
	background: linear-gradient(135deg, #ff9ed1 0%, #c88cf5 52%, #a78bfa 100%);
	border-color: rgba(255, 255, 255, 0.34);
	color: #24102f;
	font-weight: 700;
	text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
	box-shadow:
		inset 0 0 0 1px rgba(255, 255, 255, 0.38),
		inset 0 1px 0 rgba(255, 255, 255, 0.55),
		0 8px 24px rgba(255, 142, 199, 0.40);
}
.btn-primary:hover {
	background: linear-gradient(135deg, #ffb0da 0%, #d4a2ff 52%, #b69dff 100%);
	box-shadow: 0 12px 32px rgba(255, 142, 199, 0.52), inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.btn-danger {
	background: linear-gradient(150deg, rgba(251, 113, 133, 0.20), rgba(251, 113, 133, 0.07));
	border-color: rgba(251, 113, 133, 0.5);
	color: #ffb4c4;
}
.btn-danger:hover {
	background: linear-gradient(150deg, rgba(251, 113, 133, 0.32), rgba(251, 113, 133, 0.12));
	border-color: var(--danger);
	box-shadow: 0 6px 20px rgba(251, 113, 133, 0.28);
}

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); backdrop-filter: none; }
.btn-ghost:hover {
	color: var(--text);
	background: rgba(255, 255, 255, 0.08);
	border-color: transparent;
	box-shadow: none;
}

.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: calc(var(--radius-xs) - 3px); }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; }

/* ---------- 表单 ---------- */

.input, .select, .textarea {
	width: 100%;
	padding: 10px 13px;
	border-radius: var(--radius-xs);
	border: 1px solid rgba(255, 255, 255, 0.15);
	background: rgba(255, 255, 255, 0.06);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	color: var(--text);
	font-size: 14px;
	font-family: inherit;
	outline: none;
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
	transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .select:focus, .textarea:focus {
	border-color: rgba(255, 142, 199, 0.78);
	background: rgba(255, 255, 255, 0.095);
	box-shadow:
		inset 0 0 0 1px rgba(255, 142, 199, 0.55),
		0 0 0 4px rgba(255, 142, 199, 0.16),
		0 0 22px rgba(255, 142, 199, 0.18);
}
.textarea { resize: vertical; min-height: 74px; }
.select {
	appearance: none;
	background-image:
		linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
		linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
	background-position: calc(100% - 19px) 55%, calc(100% - 14px) 55%;
	background-size: 5px 5px;
	background-repeat: no-repeat;
	padding-right: 34px;
}
.select option { background: #1f1438; color: var(--text); }

.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; letter-spacing: 0.3px; }
.field .hint { font-size: 12px; color: var(--text-faint); margin-top: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }

/* ---------- 卡片与徽章 ---------- */

.card { border-radius: var(--radius); padding: 20px; }

.badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	border: 1px solid transparent;
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	white-space: nowrap;
}
.badge-ok { background: rgba(110, 231, 183, 0.16); color: #86efac; border-color: rgba(110, 231, 183, 0.36); }
.badge-off { background: rgba(251, 113, 133, 0.16); color: #fda4af; border-color: rgba(251, 113, 133, 0.36); }
.badge-unknown { background: rgba(255, 255, 255, 0.08); color: var(--text-dim); border-color: rgba(255, 255, 255, 0.18); }
.badge-warn { background: rgba(252, 211, 77, 0.16); color: #fde68a; border-color: rgba(252, 211, 77, 0.36); }

.mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0.4px; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); font-size: 12px; }

/* ---------- 顶栏 ---------- */

.topbar {
	position: sticky;
	top: 0;
	z-index: 40;
	display: flex;
	align-items: center;
	gap: 18px;
	padding: 0 22px;
	height: 62px;
	background: linear-gradient(180deg, rgba(28, 17, 52, 0.72), rgba(22, 13, 42, 0.48));
	backdrop-filter: blur(42px) saturate(210%) brightness(1.05);
	-webkit-backdrop-filter: blur(42px) saturate(210%) brightness(1.05);
	border-bottom: 1px solid rgba(255, 255, 255, 0.13);
	box-shadow: 0 6px 26px rgba(6, 2, 18, 0.42);
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	font-weight: 800;
	font-size: 16px;
	cursor: pointer;
	white-space: nowrap;
}
.brand .logo {
	display: flex;
	align-items: center;
	animation: logoPulse 3.4s ease-in-out infinite;
}
@keyframes logoPulse {
	0%, 100% { filter: drop-shadow(0 0 7px rgba(255, 142, 199, 0.55)); transform: scale(1) rotate(0deg); }
	50% { filter: drop-shadow(0 0 17px rgba(255, 142, 199, 0.95)); transform: scale(1.07) rotate(-4deg); }
}
.brand .text {
	background: linear-gradient(110deg, #ffffff 0%, var(--pink) 55%, var(--violet) 100%);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	letter-spacing: 0.6px;
}

.nav { display: flex; gap: 6px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 7px 15px;
	border-radius: 999px;
	color: var(--text-dim);
	font-size: 14px;
	cursor: pointer;
	white-space: nowrap;
	border: 1px solid transparent;
	background: none;
	transition: color 0.18s ease, background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.nav-item:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.nav-item.active {
	color: #fff;
	background: linear-gradient(135deg, rgba(255, 142, 199, 0.32), rgba(167, 139, 250, 0.32));
	border-color: rgba(255, 142, 199, 0.55);
	box-shadow: 0 4px 18px rgba(255, 142, 199, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

.user-menu { display: flex; align-items: center; gap: 10px; }
.avatar {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	background: linear-gradient(135deg, var(--pink) 0%, var(--violet) 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	font-weight: 800;
	color: #2a1038;
	font-size: 14px;
	cursor: pointer;
	border: 1px solid rgba(255, 255, 255, 0.45);
	box-shadow: 0 0 0 3px rgba(255, 142, 199, 0.16), 0 4px 16px rgba(255, 142, 199, 0.35);
	transition: transform 0.2s var(--spring), box-shadow 0.2s ease;
}
.avatar:hover {
	transform: scale(1.08) rotate(6deg);
	box-shadow: 0 0 0 4px rgba(255, 142, 199, 0.26), 0 6px 22px rgba(255, 142, 199, 0.5);
}

.page { flex: 1; padding: 24px; max-width: 1280px; width: 100%; margin: 0 auto; }

.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h1 {
	font-size: 22px;
	font-weight: 800;
	letter-spacing: 0.5px;
	background: linear-gradient(120deg, #ffffff 0%, var(--pink-soft) 45%, var(--violet) 100%);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}
.page-header .sub { font-size: 13px; color: var(--text-faint); margin-top: 3px; letter-spacing: 0.3px; }
.page-header .actions { display: flex; gap: 9px; flex-wrap: wrap; }

/* ---------- 登录 / 初始化 ---------- */

.auth-wrap {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 22px;
}
.auth-card {
	position: relative;
	overflow: hidden;
	width: 100%;
	max-width: 410px;
	border-radius: var(--radius);
	padding: 32px;
	box-shadow: 0 26px 70px rgba(6, 2, 18, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
/* 卡片顶部的樱花光晕 */
.auth-card::before {
	content: '';
	position: absolute;
	top: -58%;
	left: -18%;
	width: 136%;
	height: 118%;
	background: radial-gradient(circle at 50% 0%, rgba(255, 142, 199, 0.34), transparent 62%);
	pointer-events: none;
}
.auth-card > * { position: relative; }

.auth-brand { text-align: center; margin-bottom: 26px; }
.auth-brand .logo {
	display: flex;
	justify-content: center;
	margin-bottom: 10px;
	color: var(--pink);
	animation: logoPulse 3.4s ease-in-out infinite;
}
.auth-brand h1 {
	font-size: 21px;
	font-weight: 800;
	letter-spacing: 1px;
	background: linear-gradient(115deg, #ffffff, var(--pink), var(--violet));
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}
.auth-brand p { font-size: 13px; color: var(--text-faint); margin-top: 6px; letter-spacing: 0.3px; }

.otp-input {
	text-align: center;
	font-size: 27px;
	letter-spacing: 13px;
	font-family: var(--mono);
	padding: 13px 0 13px 13px;
	color: var(--pink-soft);
	text-shadow: 0 0 18px rgba(255, 142, 199, 0.55);
}

.qr-box { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 16px 0; }
.qr-box img {
	border-radius: var(--radius-sm);
	border: 5px solid #ffffff;
	width: 208px;
	height: 208px;
	box-shadow: 0 10px 32px rgba(255, 142, 199, 0.35);
}

.backup-codes {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 9px;
	background: rgba(255, 255, 255, 0.055);
	border: 1px dashed rgba(255, 142, 199, 0.42);
	border-radius: var(--radius-sm);
	padding: 15px;
}
.backup-codes code {
	font-family: var(--mono);
	font-size: 14px;
	text-align: center;
	color: var(--pink-soft);
	user-select: all;
	letter-spacing: 0.5px;
	text-shadow: 0 0 12px rgba(255, 142, 199, 0.35);
}

/* ---------- 仪表盘 ---------- */

.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card {
	border-radius: var(--radius);
	padding: 16px 18px;
	position: relative;
	overflow: hidden;
	transition: transform 0.22s var(--spring), box-shadow 0.22s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(255, 142, 199, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.2); }
.stat-card .num {
	font-size: 28px;
	font-weight: 800;
	font-family: var(--mono);
	line-height: 1.2;
	background: linear-gradient(120deg, var(--pink), var(--violet), var(--cyan));
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}
/* 语义化配色（用 -webkit-text-fill-color 保证覆盖内联 color） */
.stat-card .num.is-online { background: linear-gradient(120deg, #6ee7b7, #7dd3fc); -webkit-background-clip: text; background-clip: text; }
.stat-card .num.is-offline { background: linear-gradient(120deg, #fda4af, #f472b6); -webkit-background-clip: text; background-clip: text; }
.stat-card .num.is-wake { background: linear-gradient(120deg, #ff8ec7, #a78bfa); -webkit-background-clip: text; background-clip: text; }
.stat-card .label { font-size: 12px; color: var(--text-faint); margin-top: 3px; letter-spacing: 0.4px; }

.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 16px; }

.device-card {
	position: relative;
	border-radius: var(--radius);
	padding: 17px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	overflow: hidden;
	transition: transform 0.22s var(--spring), box-shadow 0.22s ease, border-color 0.22s ease;
}
.device-card::before {
	content: '';
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(135deg, rgba(255, 142, 199, 0.16), transparent 45%, rgba(167, 139, 250, 0.16));
	opacity: 0;
	transition: opacity 0.22s ease;
	pointer-events: none;
}
.device-card:hover {
	transform: translateY(-3px);
	border-color: rgba(255, 142, 199, 0.48);
	box-shadow: 0 16px 40px rgba(255, 142, 199, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.device-card:hover::before { opacity: 1; }
.device-card > * { position: relative; }
.device-card.offline-card { opacity: 0.86; }

.device-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 9px; }
.device-name { font-weight: 800; font-size: 16px; word-break: break-all; letter-spacing: 0.3px; }
.device-mac { font-size: 13px; color: var(--text-dim); }
.device-meta { font-size: 12px; color: var(--text-faint); display: flex; gap: 10px; flex-wrap: wrap; }
.device-notes { font-size: 12.5px; color: var(--text-dim); white-space: pre-wrap; word-break: break-word; }

.device-actions { display: flex; gap: 9px; margin-top: auto; padding-top: 7px; }
.device-actions .btn { flex: 1; }

.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 5px; }
.status-dot.online { background: var(--mint); box-shadow: 0 0 10px rgba(110, 231, 183, 0.95); animation: pulse 2.4s infinite; }
.status-dot.offline { background: var(--danger); box-shadow: 0 0 8px rgba(251, 113, 133, 0.65); }
.status-dot.unknown { background: var(--text-faint); }
.status-dot.checking { background: var(--gold); box-shadow: 0 0 10px rgba(252, 211, 77, 0.8); animation: pulse 1s infinite; }

@keyframes pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: 0.42; }
}

/* ---------- 表格 ---------- */

.table-wrap { border-radius: var(--radius); overflow: hidden; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 660px; }
table.data th, table.data td { padding: 11px 15px; text-align: left; border-bottom: 1px solid rgba(255, 255, 255, 0.09); }
table.data th {
	background: rgba(255, 255, 255, 0.06);
	color: var(--text-dim);
	font-weight: 600;
	font-size: 12.5px;
	white-space: nowrap;
	letter-spacing: 0.4px;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background 0.15s ease; }
table.data tbody tr:hover { background: rgba(255, 142, 199, 0.08); }

.tag-action {
	font-family: var(--mono);
	font-size: 12px;
	background: rgba(255, 142, 199, 0.14);
	color: var(--pink-soft);
	padding: 3px 9px;
	border-radius: calc(var(--radius-xs) - 4px);
	border: 1px solid rgba(255, 142, 199, 0.28);
}

/* ---------- 模态框 ---------- */

.modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(10, 6, 22, 0.62);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 100;
	padding: 20px;
	animation: fadeIn 0.18s ease;
}
.modal {
	border-radius: var(--radius);
	width: 100%;
	max-width: 530px;
	max-height: 88vh;
	overflow-y: auto;
	animation: slideUp 0.22s var(--spring);
	box-shadow: 0 26px 74px rgba(0, 0, 0, 0.62), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
.modal-lg { max-width: 690px; }
.modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 17px 21px;
	border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.modal-head h3 { font-size: 16px; font-weight: 800; letter-spacing: 0.4px; }
.modal-body { padding: 21px; }
.modal-foot {
	display: flex;
	justify-content: flex-end;
	gap: 10px;
	padding: 15px 21px;
	border-top: 1px solid rgba(255, 255, 255, 0.12);
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
	from { transform: translateY(16px) scale(0.97); opacity: 0; }
	to { transform: none; opacity: 1; }
}

/* ---------- Toast ---------- */

.toast-root {
	position: fixed;
	top: 74px;
	right: 18px;
	z-index: 200;
	display: flex;
	flex-direction: column;
	gap: 10px;
	max-width: 350px;
}
.toast {
	padding: 13px 17px;
	border-radius: var(--radius-sm);
	background: linear-gradient(150deg, rgba(56, 35, 96, 0.78), rgba(30, 19, 56, 0.86));
	backdrop-filter: blur(34px) saturate(200%) brightness(1.05);
	-webkit-backdrop-filter: blur(34px) saturate(200%) brightness(1.05);
	border: 1px solid var(--glass-border);
	box-shadow: var(--shadow-soft);
	font-size: 14px;
	display: flex;
	gap: 10px;
	align-items: flex-start;
	animation: slideUp 0.22s var(--spring);
}
.toast.success { border-left: 3px solid var(--mint); box-shadow: var(--shadow-soft), -4px 0 20px rgba(110, 231, 183, 0.25); }
.toast.error { border-left: 3px solid var(--danger); box-shadow: var(--shadow-soft), -4px 0 20px rgba(251, 113, 133, 0.25); }
.toast.info { border-left: 3px solid var(--pink); box-shadow: var(--shadow-soft), -4px 0 20px rgba(255, 142, 199, 0.25); }
.toast .msg { flex: 1; word-break: break-word; }

/* ---------- 设置页 ---------- */

.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(325px, 1fr)); gap: 16px; }
.settings-card { border-radius: var(--radius); padding: 20px; }
.settings-card h3 { font-size: 15px; margin-bottom: 5px; display: flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: 0.3px; }
.settings-card .desc { font-size: 12.5px; color: var(--text-faint); margin-bottom: 15px; }

.kv-list { display: flex; flex-direction: column; gap: 9px; }
.kv-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 9px 0;
	border-bottom: 1px dashed rgba(255, 255, 255, 0.11);
	font-size: 13.5px;
	gap: 10px;
}
.kv-row:last-child { border-bottom: none; }
.kv-row .k { color: var(--text-dim); }
.kv-row .v { text-align: right; word-break: break-all; }

/* ---------- 空状态 ---------- */

.empty { text-align: center; padding: 54px 20px; color: var(--text-faint); }
.empty .icon {
	font-size: 44px;
	margin-bottom: 12px;
	opacity: 0.7;
	display: inline-block;
	animation: floaty 3.6s ease-in-out infinite;
}
@keyframes floaty {
	0%, 100% { transform: translateY(0); }
	50% { transform: translateY(-7px); }
}

/* ---------- 加载 ---------- */

.loading-dots::after { content: '…'; animation: dots 1.2s steps(4) infinite; }
@keyframes dots {
	0% { content: ''; }
	25% { content: '.'; }
	50% { content: '..'; }
	75% { content: '...'; }
}

.spin {
	display: inline-block;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255, 255, 255, 0.18);
	border-top-color: var(--pink);
	border-right-color: var(--violet);
	border-radius: 50%;
	animation: spin 0.72s linear infinite;
	box-shadow: 0 0 12px rgba(255, 142, 199, 0.45);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 分组标题 ---------- */

.group-title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 24px 0 12px;
	font-size: 13px;
	color: var(--text-dim);
	font-weight: 700;
	letter-spacing: 0.6px;
}
.group-title::before {
	content: '✧';
	color: var(--pink);
	font-size: 14px;
	text-shadow: 0 0 12px rgba(255, 142, 199, 0.7);
}
.group-title::after {
	content: '';
	flex: 1;
	height: 1px;
	background: linear-gradient(90deg, rgba(255, 142, 199, 0.45), rgba(167, 139, 250, 0.25), transparent);
}

/* ---------- 阴影：mask 会裁掉外部 box-shadow，改用 drop-shadow 跟随形状 ---------- */
.card,
.stat-card,
.device-card,
.settings-card,
.table-wrap,
.modal,
.auth-card,
.toast {
	filter: drop-shadow(0 10px 28px rgba(4, 2, 14, 0.55));
}

.btn-primary { filter: drop-shadow(0 6px 18px rgba(255, 142, 199, 0.42)); }
.btn-primary:hover { filter: drop-shadow(0 10px 26px rgba(255, 142, 199, 0.58)); }
.btn-danger { filter: drop-shadow(0 4px 14px rgba(251, 113, 133, 0.28)); }

/* ---------- SVG 图标 ---------- */

.ico {
	display: inline-block;
	vertical-align: -0.18em;
	flex-shrink: 0;
}

.btn .ico { vertical-align: -0.2em; }
.btn > span { line-height: 1; }
.nav-item .ico { opacity: 0.92; }

/* 品牌标识 */
.brand-mark {
	display: block;
	border-radius: 9px;
	filter: drop-shadow(0 2px 10px rgba(255, 142, 199, 0.45));
}

/* 空状态 */
.empty .icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var(--pink);
}
.empty .icon .ico { opacity: 0.8; }
.empty-icon-lg {
	display: flex;
	justify-content: center;
	color: var(--pink);
	margin-bottom: 8px;
}

/* Toast 图标着色 */
.toast-ico { display: inline-flex; align-items: center; margin-top: 1px; }
.toast.success .toast-ico { color: var(--mint); }
.toast.error .toast-ico { color: var(--danger); }
.toast.info .toast-ico { color: var(--pink); }

/* 设置卡片标题图标 */
.settings-card h3 .ico { color: var(--pink); opacity: 0.95; }

/* 会话状态图标 */
.kv-row .k .ico { color: var(--mint); vertical-align: -0.16em; }

/* ---------- 响应式 ---------- */

@media (max-width: 720px) {
	.page { padding: 15px; }
	.topbar { padding: 0 13px; gap: 10px; height: 58px; }
	.brand span.text { display: none; }
	.field-row { grid-template-columns: 1fr; }
	.otp-input { font-size: 22px; letter-spacing: 9px; }
	.toast-root { left: 14px; right: 14px; max-width: none; }
	.auth-card { padding: 24px; }
	.device-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
	* {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
	}
}
