:root {
  /* 现代企业级 shadcn-vue / Tailwind 极简中性高质感调色板 */
  --bg-primary: #f8fafc;         /* 整体浅冷灰底色 (Slate 50) */
  --bg-surface: #ffffff;         /* 卡片纯白表层 (Card Background) */
  --bg-muted: #f1f5f9;           /* 次级灰底 (Slate 100) */
  --bg-subtle: #f8fafc;
  --bg-hover: #e2e8f0;           /* 悬停浅灰 (Slate 200) */
  
  --text-main: #0f172a;          /* 深度黑字 (Slate 900) */
  --text-secondary: #334155;     /* 次级正文 (Slate 700) */
  --text-muted: #64748b;         /* 辅助说明灰 (Slate 500) */
  
  --border: #e2e8f0;             /* 极细中性分割边框 (Slate 200) */
  --border-focus: #94a3b8;
  
  --accent: #2563eb;             /* 核心品牌蓝 (Blue 600) */
  --accent-hover: #1d4ed8;       /* 悬停群青 (Blue 700) */
  --accent-light: #eff6ff;       /* 浅蓝背景 (Blue 50) */
  
  --success: #16a34a;            /* 翠绿 (Emerald 600) */
  --success-bg: #f0fdf4;
  --warning: #d97706;            /* 琥珀 (Amber 600) */
  --warning-bg: #fffbeb;
  --danger: #dc2626;             /* 猩红 (Rose 600) */
  --danger-bg: #fef2f2;
  
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Inter", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  padding: 24px;
}

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

/* 顶部导航 Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

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

.logo-icon {
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--accent-light);
  border-radius: var(--radius);
  border: 1px solid rgba(37, 99, 235, 0.15);
}

.title-group h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

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

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

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

.avatar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b, #334155);
  color: #ffffff;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
  user-select: none;
}

.avatar-btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 180px;
  padding: 6px;
  z-index: 500;
  display: flex;
  flex-direction: column;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  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;
}

.dropdown-item:hover {
  background-color: var(--bg-muted);
  color: var(--text-main);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* 统计指标卡片 (shadcn KPI Card 规范) */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

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

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  background: var(--bg-muted);
  color: var(--text-main);
  border: 1px solid var(--border);
}

.stat-info .stat-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

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

/* 现代按钮规范 (shadcn Button 规范) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--bg-surface);
  color: var(--text-main);
  text-decoration: none;
  line-height: 1.2;
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-hover);
}

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

.btn-primary {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

.btn-primary:hover {
  background: #1e293b;
  border-color: #1e293b;
}

.btn-accent {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.btn-accent:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-success {
  background: var(--success-bg);
  color: #15803d;
  border-color: rgba(22, 163, 74, 0.2);
}

.btn-success:hover {
  background: #dcfce7;
}

.btn-warning {
  background: var(--warning-bg);
  color: #b45309;
  border-color: rgba(217, 119, 6, 0.2);
}

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

.btn-danger {
  background: var(--danger-bg);
  color: #b91c1c;
  border-color: rgba(220, 38, 38, 0.2);
}

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

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

/* 主直达大按钮 */
.btn-launch-full {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.btn-launch-full:hover {
  background: linear-gradient(135deg, #1e40af, #1d4ed8);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
  transform: translateY(-1px);
}

.btn-subtext {
  font-size: 11px;
  font-weight: 400;
  opacity: 0.85;
}

/* 账号卡片网格 */
.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.account-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: all 0.2s ease;
  position: relative;
}

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

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.account-main-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.account-avatar {
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
}

.account-name-block h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-phone {
  font-size: 12px;
  color: var(--text-muted);
}

/* 药丸徽标 Pill Badge */
.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 9999px;
  font-weight: 500;
}

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

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

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

/* 设备码框 */
.device-box {
  background: var(--bg-muted);
  padding: 8px 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: monospace;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

/* 自动化开关盒子 */
.features-box {
  background: var(--bg-surface);
  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 / shadcn 风格开关 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.2s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 9999px;
}

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

input:checked + .slider {
  background-color: #0f172a;
}

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: 7px 6px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  border: 1px solid var(--border);
}

.btn-tool:hover {
  background: #e2e8f0;
}

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

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

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

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

.mac-dot {
  width: 10px;
  height: 10px;
  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, "Liberation Mono", monospace;
  font-size: 12px;
  padding: 16px 18px;
  height: 380px;
  overflow-y: auto;
  line-height: 1.65;
}

.log-line {
  display: flex;
  align-items: flex-start;
  margin-bottom: 3px;
  word-break: break-all;
  transition: background-color 0.2s ease;
  padding: 2px 4px;
  border-radius: 4px;
}

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

.log-time {
  color: #94a3b8;
  margin-right: 8px;
  flex-shrink: 0;
}

.log-source {
  color: #2563eb;
  margin-right: 8px;
  font-weight: 600;
  flex-shrink: 0;
}

.log-text {
  flex: 1;
}

.log-level-success {
  color: #15803d;
  font-weight: 500;
}

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

.log-level-warning {
  color: #b45309;
  font-weight: 500;
  background: #fffbeb;
  border-radius: 4px;
}

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

/* 全双工重复折叠徽标 Badge Repeat (x2, x99) */
.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: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  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 (shadcn Dialog 规范) */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(6px);
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 540px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: modal-enter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

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

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

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

.form-group label {
  font-size: 13px;
  font-weight: 500;
  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: var(--bg-surface);
  transition: all 0.15s;
}

.form-control:focus {
  outline: none;
  border-color: #0f172a;
  box-shadow: 0 0 0 1px #0f172a;
}

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

.hidden {
  display: none !important;
}

/* Toast 提示 */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  color: #ffffff;
  animation: slideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-success { background: #0f172a; border-left: 4px solid #16a34a; }
.toast-error { background: #0f172a; border-left: 4px solid #dc2626; }
.toast-info { background: #0f172a; border-left: 4px solid #2563eb; }

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

/* 响应式设计 (完美自适应手机移动端与桌面大屏) */
@media (max-width: 768px) {
  body {
    padding: 12px;
  }
  
  header {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 14px;
  }
  
  .header-actions {
    justify-content: space-between;
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  
  .stat-card {
    padding: 14px;
    gap: 10px;
  }
  
  .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }
  
  .stat-info .stat-value {
    font-size: 20px;
  }
  
  .accounts-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  
  .card-action-tools {
    grid-template-columns: 1fr 1fr;
  }
  
  .btn-tool {
    padding: 9px 8px;
    font-size: 12.5px;
  }
  
  .modal {
    width: 95%;
    max-height: 90vh;
    border-radius: var(--radius);
  }
}
