:root {
  /* 现代顶级 SaaS / Linear & Vercel Pro 级质感调色板 */
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-subtle: #f8fafc;
  --bg-hover: #e2e8f0;
  
  --text-main: #0f172a;          /* 深度黑字 (Slate 900) */
  --text-secondary: #334155;     /* 次级正文 (Slate 700) */
  --text-muted: #64748b;         /* 辅助说明灰 (Slate 500) */
  
  --border: #e2e8f0;             /* 极细中性边框 */
  --border-focus: #3b82f6;
  
  --accent: #3b82f6;             /* 核心科技蓝 */
  --accent-hover: #2563eb;
  --accent-light: #eff6ff;
  --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #2563eb 50%, #06b6d4 100%);
  --accent-gradient-hover: linear-gradient(135deg, #4338ca 0%, #1d4ed8 50%, #0891b2 100%);
  
  --success: #10b981;            /* 翡翠绿 (Emerald 500) */
  --success-bg: #ecfdf5;
  --warning: #f59e0b;            /* 琥珀金 (Amber 500) */
  --warning-bg: #fffbeb;
  --danger: #ef4444;             /* 猩红 (Rose 500) */
  --danger-bg: #fef2f2;
  --purple: #8b5cf6;
  --purple-bg: #f5f3ff;
  
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 22px;
  
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow-sm: 0 2px 4px 0 rgb(0 0 0 / 0.05), 0 1px 2px -1px rgb(0 0 0 / 0.05);
  --shadow: 0 4px 12px -2px rgb(15 23 42 / 0.08), 0 2px 6px -2px rgb(15 23 42 / 0.04);
  --shadow-md: 0 12px 24px -4px rgb(15 23 42 / 0.1), 0 4px 8px -4px rgb(15 23 42 / 0.05);
  --shadow-lg: 0 20px 32px -6px rgb(15 23 42 / 0.14), 0 8px 16px -6px rgb(15 23 42 / 0.06);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Inter", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 10% 10%, rgba(99, 102, 241, 0.06) 0px, transparent 40%),
    radial-gradient(at 90% 12%, rgba(6, 182, 212, 0.06) 0px, transparent 40%),
    radial-gradient(at 50% 95%, rgba(16, 185, 129, 0.04) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  padding: 24px;
}

.container {
  max-width: 1320px;
  margin: 0 auto;
}

/* 顶部导航 Header (sticky 吸顶：下拉滚动时始终可见，随时添加云电脑/系统设置) */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: var(--radius-lg);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05), inset 0 1px 0 0 rgba(255, 255, 255, 0.9);
  transition: all 0.25s ease;
}

header:hover {
  box-shadow: 0 8px 25px -4px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
}

.logo-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-icon {
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--accent-gradient);
  color: #ffffff;
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
  position: relative;
  overflow: hidden;
}

.logo-icon::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 100%);
}

.title-group h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-group p {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 400;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 优雅用户与系统下拉框 */
.user-dropdown {
  position: relative;
  display: inline-block;
}

.avatar-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 2px solid #ffffff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.18);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.avatar-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.3);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(226, 232, 240, 0.95);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 200px;
  padding: 8px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  animation: dropdown-pop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: top right;
}

@keyframes dropdown-pop {
  from { opacity: 0; transform: scale(0.95) translateY(-8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}

.dropdown-item:hover {
  background-color: #f1f5f9;
  color: #0f172a;
  transform: translateX(3px);
}

.dropdown-divider {
  height: 1px;
  background: #f1f5f9;
  margin: 5px 0;
}

/* 顶级色彩体系：SaaS KPI 统计指标卡片 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  box-shadow: var(--shadow-xs);
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

/* 顶级极简统一规范：SaaS KPI 统计指标卡片 (消除杂乱花哨多色) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
  position: relative;
  z-index: 1;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px -5px rgba(15, 23, 42, 0.08);
  border-color: #94a3b8;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  background: #f8fafc;
  border: 1px solid var(--border);
  color: var(--text-main);
  transition: transform 0.25s ease, background-color 0.2s ease;
}

.stat-card:hover .stat-icon {
  transform: scale(1.08);
  background: #f1f5f9;
}

.stat-info .stat-value {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
  color: var(--text-main);
  letter-spacing: -0.03em;
}

.stat-info .stat-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  margin-top: 3px;
}

/* 预设头像选择按钮 */
.avatar-preset-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border);
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.avatar-preset-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  transform: scale(1.12);
}

.avatar-preset-btn:active {
  transform: scale(0.95);
}

/* 现代按钮规范 (高质感微光) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  background: #ffffff;
  color: var(--text-main);
  text-decoration: none;
  line-height: 1.2;
  white-space: nowrap;
  user-select: none;
}

.btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  border-color: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  border-color: #1e293b;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.3);
}

.btn-accent {
  background: var(--accent-gradient);
  color: #ffffff;
  border: none;
  box-shadow: 0 3px 10px rgba(79, 70, 229, 0.28);
}

.btn-accent:hover {
  background: var(--accent-gradient-hover);
  box-shadow: 0 5px 16px rgba(79, 70, 229, 0.38);
}

.btn-success {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.btn-success:hover {
  background: #d1fae5;
  border-color: #6ee7b7;
}

.btn-warning {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.btn-warning:hover {
  background: #fef3c7;
  border-color: #fcd34d;
}

.btn-danger {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.btn-danger:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

/* 主直达大按钮 (渐变高质感光效) */
.btn-launch-full {
  width: 100%;
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--accent-gradient);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.32);
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

.btn-launch-full::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, transparent 100%);
}

.btn-launch-full:hover {
  background: var(--accent-gradient-hover);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.42);
  transform: translateY(-2px);
}

.btn-subtext {
  font-size: 11.5px;
  font-weight: 400;
  opacity: 0.92;
}

/* 区域标题栏 */
.section-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 14px;
  margin-top: 26px;
  margin-bottom: 16px;
  padding: 0 2px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.section-title span {
  font-size: 19px;
}

.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 12.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}

.btn-refresh:hover {
  background: #f8fafc;
  color: var(--text-main);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.btn-refresh:active {
  transform: scale(0.97);
}

/* 账号卡片网格 (高质感组件化，卡片高度自适应内容，不拉伸对齐) */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  align-items: start; /* 关键：各卡片高度根据自身内容自适应，消除空余留白 */
  gap: 20px;
  margin-bottom: 28px;
}

.account-card {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: 0 2px 8px -2px rgba(15, 23, 42, 0.05);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  height: fit-content; /* 自适应高度 */
}

/* 拖拽交互样式 */
.account-card.dragging {
  opacity: 0.45;
  transform: scale(0.98);
  box-shadow: 0 15px 30px rgba(15, 23, 42, 0.2);
  border: 2px dashed #3b82f6;
}

.account-card.drag-over {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.35);
  transform: translateY(-2px);
}

/* 网格空位放置占位槽 (默认纯透明留白无边框无文字，拖拽到对应区域时才浮现指示) */
.grid-empty-slot {
  border: 1.5px dashed transparent;
  border-radius: var(--radius-lg);
  min-height: 180px;
  height: 100%;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  position: relative;
}

.grid-empty-slot.droppable {
  border-color: rgba(147, 197, 253, 0.4);
  background: rgba(239, 246, 255, 0.2);
}

.grid-empty-slot.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.12);
  transform: translateY(-2px);
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  cursor: grab; /* 顶部区域支持抓取拖拽 */
  user-select: none;
}

.card-top:active {
  cursor: grabbing;
}

.account-main-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.account-avatar {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #f8fafc 0%, #edf2f7 100%);
  color: #0f172a;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  flex-shrink: 0;
}

.account-name-block {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.account-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.account-name-text {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  padding: 2px 6px;
  margin: -2px -6px;
  border-radius: var(--radius-sm);
  border: 1px dashed transparent;
  transition: all 0.15s ease;
  user-select: none;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-name-text:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #2563eb;
}

.account-name-text:hover .name-edit-icon {
  opacity: 0.85;
}

.name-edit-icon {
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.15s ease;
  color: #64748b;
  flex-shrink: 0;
}

.inline-name-input {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
  padding: 4px 8px;
  border: 1.5px solid #3b82f6;
  border-radius: var(--radius-sm);
  background: #ffffff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
  width: 140px;
  height: 28px;
  box-sizing: border-box;
}

.account-phone {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  line-height: 1.4;
}

/* 药丸徽标 Pill Badge (极简紧凑规范) */
.badge {
  font-size: 10.5px;
  padding: 1px 7px;
  border-radius: 9999px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.4;
}

.badge-online {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-online::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse-dot 1.8s infinite;
}

@keyframes pulse-dot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.badge-offline {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.badge-offline::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
}

.badge-warning {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

/* 设备码框 */
.device-box {
  background: #f8fafc;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
}

.device-code-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

/* 自动化开关盒子 */
.features-box {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.feature-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* iOS / Tailwind 风格极简精致开关 Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 9999px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

input:checked + .slider {
  background: var(--accent-gradient);
}

input:checked + .slider:before {
  transform: translateX(16px);
}

/* 卡片操作区 */
.card-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.card-action-tools {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.btn-tool {
  padding: 8px 6px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border-radius: var(--radius-sm);
  background: #f8fafc;
  border: 1px solid var(--border);
  transition: all 0.18s ease;
}

.btn-tool:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #0f172a;
  transform: translateY(-1px);
}

/* 微型单机独立控制胶囊开关 (Pill Toggle Button & VM Row) */
.vm-device-item {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  gap: 6px;
  transition: all 0.2s ease;
}

.vm-device-item:hover {
  border-color: #cbd5e1;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.vm-device-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.vm-device-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding-top: 5px;
  border-top: 1px dashed #f1f5f9;
  flex-wrap: wrap;
}

.pill-btn-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.pill-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  user-select: none;
  transition: all 0.15s ease;
  line-height: 1.35;
}

.pill-toggle-btn:hover {
  transform: translateY(-1px);
  filter: brightness(0.96);
}

.pill-toggle-btn:active {
  transform: scale(0.96);
}

.pill-toggle-btn.pill-on-keepalive {
  background: #ecfdf5;
  color: #059669;
  border-color: #a7f3d0;
}

.pill-toggle-btn.pill-off-keepalive {
  background: #f8fafc;
  color: #94a3b8;
  border-color: #e2e8f0;
}

.pill-toggle-btn.pill-on-autoboot {
  background: #eff6ff;
  color: #2563eb;
  border-color: #bfdbfe;
}

.pill-toggle-btn.pill-off-autoboot {
  background: #f8fafc;
  color: #94a3b8;
  border-color: #e2e8f0;
}

.pill-toggle-btn.pill-on-task {
  background: #faf5ff;
  color: #7c3aed;
  border-color: #ddd6fe;
}

.pill-toggle-btn.pill-off-task {
  background: #f8fafc;
  color: #94a3b8;
  border-color: #e2e8f0;
}

.pill-toggle-btn.pill-paused {
  background: #fefce8;
  color: #ca8a04;
  border-color: #fef08a;
}

.pill-select {
  display: inline-flex;
  align-items: center;
  padding: 1.5px 6px;
  border-radius: 9999px;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #475569;
  outline: none;
  line-height: 1.35;
  transition: all 0.15s ease;
}

.pill-select:hover {
  border-color: #cbd5e1;
  background: #ffffff;
}

.pill-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.pill-toggle-btn.pill-action-boot {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
  cursor: pointer;
}
.pill-toggle-btn.pill-action-boot:hover {
  background: #dcfce7;
  border-color: #86efac;
}

/* 现代化控制台日志面板 (macOS Window Style) */
.log-panel {
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-top: 24px;
  transition: all 0.25s ease;
}

.log-panel:hover {
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.log-header {
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.log-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.log-title {
  font-weight: 700;
  font-size: 13px;
  color: var(--text-main);
}

.log-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.log-filter-group {
  display: inline-flex;
  gap: 3px;
  background: #f1f5f9;
  padding: 2px 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.log-filter-group .btn {
  padding: 3px 8px;
  font-size: 11.5px;
}

.log-action-group {
  display: inline-flex;
  gap: 6px;
}

.log-action-group .btn {
  padding: 3px 10px;
  font-size: 11.5px;
}

.mac-dots {
  display: flex;
  align-items: center;
  gap: 5px;
}

.mac-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.mac-dot-red { background: #ef4444; }
.mac-dot-yellow { background: #f59e0b; }
.mac-dot-green { background: #10b981; }

.log-content {
  background: #ffffff;
  color: #1e293b;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "PingFang SC", "Microsoft YaHei", monospace;
  font-size: 12px;
  padding: 10px 14px;
  height: 380px;
  overflow-y: auto;
  line-height: 1.45;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
  word-break: break-word;
}

.log-content::-webkit-scrollbar {
  width: 6px;
}

.log-content::-webkit-scrollbar-thumb {
  background-color: #cbd5e1;
  border-radius: 9999px;
}

.log-line {
  display: block;
  margin-bottom: 2px;
  word-break: break-word;
  white-space: normal;
  padding: 1px 3px;
  border-radius: 3px;
  line-height: 1.45;
  transition: background-color 0.15s ease;
}

.log-line:hover {
  background-color: #f8fafc;
}

.log-flash {
  background-color: #f1f5f9;
}

.log-time {
  color: #94a3b8;
  margin-right: 5px;
  display: inline;
  font-size: 11px;
  user-select: none;
  font-variant-numeric: tabular-nums;
}

.log-source {
  color: #2563eb;
  margin-right: 5px;
  font-weight: 700;
  display: inline;
  font-size: 11.5px;
}

.log-text {
  display: inline;
  word-break: break-word;
}

.log-level-success {
  color: #059669;
  font-weight: 600;
}

.log-level-error {
  color: #dc2626;
  font-weight: 600;
  background: #fef2f2;
}

.log-level-warning {
  color: #b45309;
  font-weight: 600;
  background: #fffbeb;
}

.log-level-info {
  color: #334155;
}

/* 全双工重复折叠徽标 Badge Repeat */
.badge-repeat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  height: 18px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 700;
  background: #e0e7ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  margin-left: 8px;
  flex-shrink: 0;
  animation: badge-pop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes badge-pop {
  0% { transform: scale(0.85); }
  50% { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* 模态框 Modal (Tailwind / Linear 级居中浮窗) */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal {
  background: #ffffff;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 550px;
  max-height: 88vh;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  animation: modal-enter 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.96) translateY(12px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8fafc;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.modal-body {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
  flex-shrink: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-control {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-main);
  background: #ffffff;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.form-control:focus {
  outline: none;
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.16);
}

.form-text {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

/* Toast 提示 (极简紧凑自适应尺寸，消除生硬长条) */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  z-index: 3000;
  pointer-events: none;
  max-width: 360px;
}

.toast {
  display: inline-flex;
  width: auto;
  max-width: 360px;
  padding: 9px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.25);
  color: #ffffff;
  animation: slideIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: auto;
  align-items: center;
  gap: 8px;
  word-break: break-word;
  white-space: pre-line;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.toast-success { background: rgba(15, 23, 42, 0.92); border-left: 3.5px solid #10b981; }
.toast-error { background: rgba(15, 23, 42, 0.92); border-left: 3.5px solid #ef4444; }
.toast-info { background: rgba(15, 23, 42, 0.92); border-left: 3.5px solid #3b82f6; }
.toast-warning { background: rgba(15, 23, 42, 0.92); border-left: 3.5px solid #f59e0b; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* 响应式设计 (深度适配手机端与全尺寸移动设备，彻底杜绝横向溢出与错位) */
@media (max-width: 768px) {
  body {
    padding: 8px;
    overflow-x: hidden;
    width: 100%;
  }

  .container {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }
  
  header {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    border-radius: var(--radius);
  }

  .logo-group {
    gap: 8px;
  }

  .logo-icon {
    width: 34px;
    height: 34px;
    font-size: 18px;
    flex-shrink: 0;
  }

  .title-group h1 {
    font-size: 14.5px;
    gap: 4px;
    line-height: 1.3;
  }

  .title-group p {
    font-size: 10.5px;
    line-height: 1.35;
    margin-top: 1px;
  }
  
  .header-actions {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
  }

  #logged-actions-group {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
  }

  #logged-actions-group .btn {
    padding: 5px 8px;
    font-size: 11.5px;
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 12px;
  }
  
  .stat-card {
    padding: 9px 10px;
    gap: 8px;
    border-radius: var(--radius-sm);
  }
  
  .stat-icon {
    width: 32px;
    height: 32px;
    font-size: 15px;
    flex-shrink: 0;
  }
  
  .stat-info .stat-value {
    font-size: 18px;
  }

  .stat-info .stat-label {
    font-size: 10.5px;
  }

  .section-header {
    margin-top: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: space-between;
  }

  .section-title {
    font-size: 13.5px;
    gap: 4px;
  }

  .section-title span {
    font-size: 15px;
  }

  #account-view-tabs-group {
    gap: 2px;
    padding: 2px;
  }

  #account-view-tabs-group .btn-sm {
    padding: 3px 6px;
    font-size: 10.5px;
  }

  .btn-refresh {
    padding: 3px 7px;
    font-size: 10.5px;
  }
  
  .accounts-grid {
    grid-template-columns: 100%;
    width: 100%;
    max-width: 100%;
    gap: 10px;
    margin-bottom: 14px;
    box-sizing: border-box;
  }

  .account-card {
    padding: 12px;
    gap: 10px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
    overflow: hidden;
  }

  .card-top {
    gap: 6px;
    align-items: center;
  }

  .account-avatar {
    width: 36px;
    height: 36px;
    font-size: 13.5px;
    flex-shrink: 0;
  }

  .account-name-text {
    font-size: 13px;
  }

  .inline-name-input {
    width: 110px;
    font-size: 12.5px;
    height: 26px;
  }

  .account-phone {
    font-size: 10.5px;
    gap: 3px;
  }

  .badge {
    font-size: 9.5px;
    padding: 1px 5px;
  }

  .card-collapse-box {
    padding: 8px 10px;
  }

  .features-box {
    padding: 8px 10px;
    gap: 6px;
  }

  .feature-row {
    font-size: 11.5px;
    gap: 6px;
  }

  .card-action-tools {
    grid-template-columns: 1fr 1fr 1fr;
    gap: 4px;
  }

  .btn-tool {
    padding: 6px 2px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
  }

  .card-actions {
    padding-top: 8px;
    gap: 6px;
  }

  /* 模态框手机自适应优化 */
  .modal-backdrop {
    padding: 8px;
  }

  .modal {
    width: 100%;
    max-width: 100%;
    max-height: 94vh;
    border-radius: var(--radius);
  }

  .modal-header {
    padding: 10px 14px;
  }

  .modal-header h3 {
    font-size: 14px;
  }

  .modal-body {
    padding: 12px;
    gap: 10px;
  }

  .modal-footer {
    padding: 8px 12px;
    gap: 6px;
  }

  .modal-footer .btn {
    flex: 1;
    justify-content: center;
    padding: 7px 10px;
    font-size: 12px;
  }

  /* 日志控制台手机优化：层级清晰，无错位与突兀空白 */
  .log-panel {
    margin-top: 14px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }

  .log-header {
    padding: 8px 10px;
    gap: 6px;
    flex-direction: column;
    align-items: stretch;
  }

  .log-header-left {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .log-header-controls {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
  }

  .log-filter-group {
    display: flex;
    width: 100%;
    gap: 2px;
  }

  .log-filter-group .btn {
    flex: 1;
    padding: 4px 2px;
    font-size: 10.5px;
    justify-content: center;
    text-align: center;
  }

  .log-action-group {
    display: flex;
    width: 100%;
    gap: 6px;
  }

  .log-action-group .btn {
    flex: 1;
    padding: 4px 6px;
    font-size: 11px;
    justify-content: center;
  }

  .log-content {
    height: 250px;
    padding: 6px 8px;
    font-size: 11px;
    line-height: 1.4;
  }

  .log-line {
    display: block;
    margin-bottom: 2px;
    word-break: break-word;
    white-space: normal;
    padding: 1px 2px;
    line-height: 1.4;
  }

  .log-time {
    display: inline;
    font-size: 10px;
    margin-right: 3px;
  }

  .log-source {
    display: inline;
    font-size: 10.5px;
    margin-right: 3px;
  }

  .log-text {
    display: inline;
    word-break: break-word;
  }

  /* 手机端 Toast 居中提示 */
  #toast-container {
    top: 8px;
    left: 8px;
    right: 8px;
    max-width: calc(100% - 16px);
    align-items: center;
  }

  .toast {
    max-width: 100%;
    width: 100%;
    font-size: 11.5px;
    padding: 7px 10px;
    justify-content: center;
    text-align: center;
  }

  /* 下拉菜单手机防溢出 */
  .dropdown-menu {
    max-width: 220px;
    right: 0;
  }
}

/* 超窄屏手机进一步微调 (iPhone SE / 375px 以下) */
@media (max-width: 480px) {
  .title-group h1 {
    font-size: 13.5px;
  }

  .title-group p {
    font-size: 10px;
  }

  .card-action-tools {
    grid-template-columns: 1fr 1fr;
    gap: 4px;
  }

  .card-action-tools button:last-child {
    grid-column: span 2;
  }

  .stats-grid {
    gap: 5px;
  }

  .stat-card {
    padding: 8px 9px;
  }

  .stat-icon {
    width: 28px;
    height: 28px;
    font-size: 14px;
  }

  .stat-info .stat-value {
    font-size: 16px;
  }
}
