/* =========================================================
   网易MC机器人控制面板 · 设计系统
   取自 fuhong-dashboard 的配色 / 组件 / 字体规范
   ========================================================= */

:root {
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-800: #1e40af;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;

  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;

  --green: #10b981;
  --green-50: #ecfdf5;
  --green-700: #047857;

  --orange: #f59e0b;
  --orange-600: #ea580c;
  --orange-50: #fff7ed;

  --purple: #8b5cf6;
  --purple-50: #f5f3ff;

  --red: #ef4444;
  --red-600: #dc2626;
  --red-50: #fef2f2;
  --red-100: #fee2e2;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-pop: 0 4px 12px rgba(0, 0, 0, 0.15);
  --sidebar-w: 220px;
  --topbar-h: 60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, #f0f4ff 0%, #f8faff 100%);
  color: var(--slate-800);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

#app { min-height: 100vh; }

.hidden { display: none !important; }
.mono { font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace; }
.muted { color: var(--slate-400); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.nowrap { white-space: nowrap; }
.break-all { word-break: break-all; }

.boot {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--slate-500);
}

/* ===== 图标 ===== */
.icon { display: inline-flex; align-items: center; justify-content: center; }
.icon svg { display: block; }

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  line-height: 1.4;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  user-select: none;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}
.btn-primary:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
  background: #fff;
  color: var(--slate-600);
  border-color: var(--slate-200);
}
.btn-secondary:not(:disabled):hover { background: var(--slate-50); border-color: var(--slate-300); }

.btn-danger {
  background: #fff;
  color: var(--red-600);
  border-color: var(--red-100);
}
.btn-danger:not(:disabled):hover { background: var(--red-50); border-color: #fecaca; }

.btn-ghost {
  background: transparent;
  color: var(--slate-600);
  border-color: transparent;
  padding: 6px 10px;
}
.btn-ghost:not(:disabled):hover { background: var(--slate-100); color: var(--blue-600); }

.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-block { width: 100%; }

/* ===== 卡片 ===== */
.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  margin-bottom: 20px;
}
.card:last-child { margin-bottom: 0; }
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--slate-900);
}
.card-title .icon { color: var(--blue-500); }
.card-desc { font-size: 12px; color: var(--slate-400); margin-top: 2px; }
.card-actions { display: flex; gap: 8px; flex-shrink: 0; }
.card-flat { background: var(--slate-50); box-shadow: none; }

/* ===== 页面结构 ===== */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: #fff;
  border-right: 1px solid var(--slate-200);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  left: 0;
  top: 0;
  z-index: 100;
}
.sidebar-logo {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo .logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
}
.logo-title { font-size: 16px; font-weight: 700; color: var(--blue-800); line-height: 1.3; }
.logo-subtitle { font-size: 12px; color: var(--slate-500); }

.sidebar-menu { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-group-title {
  font-size: 11px;
  color: var(--slate-400);
  padding: 12px 12px 4px;
  letter-spacing: 0.05em;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--slate-600);
  margin-bottom: 2px;
  transition: all 0.2s;
  font-size: 14px;
}
.menu-item .icon svg { width: 18px; height: 18px; }
.menu-item:hover { background: var(--slate-100); color: var(--blue-800); }
.menu-item.active { background: var(--blue-50); color: var(--blue-600); font-weight: 500; }

.sidebar-footer { padding: 12px 10px; border-top: 1px solid var(--slate-100); }

.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.top-navbar {
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.breadcrumb { display: flex; flex-direction: column; min-width: 0; }
.breadcrumb-level { font-size: 12px; color: var(--slate-400); line-height: 1.4; }
.breadcrumb-current { font-size: 15px; font-weight: 600; color: var(--slate-800); line-height: 1.4; }

.user-info { display: flex; align-items: center; gap: 12px; }
.user-details { text-align: right; }
.user-name { font-size: 13px; font-weight: 600; color: var(--slate-800); }
.user-plan { font-size: 11px; color: var(--slate-400); }
.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
  text-transform: uppercase;
}

.content-container {
  padding: 24px 28px 40px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.page-title { font-size: 24px; font-weight: 700; color: var(--slate-900); line-height: 1.3; }
.page-sub { font-size: 13px; color: var(--slate-500); margin-top: 2px; }
.page-actions { display: flex; gap: 8px; align-items: center; }

/* ===== 统计卡片 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: '';
  position: absolute;
  right: -20px;
  bottom: -20px;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  opacity: 0.1;
}
.stat-card.blue::after { background: var(--blue-500); }
.stat-card.green::after { background: var(--green); }
.stat-card.orange::after { background: var(--orange); }
.stat-card.purple::after { background: var(--purple); }

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.blue { background: var(--blue-50); color: var(--blue-500); }
.stat-icon.green { background: var(--green-50); color: var(--green); }
.stat-icon.orange { background: var(--orange-50); color: var(--orange); }
.stat-icon.purple { background: var(--purple-50); color: var(--purple); }

.stat-label { font-size: 13px; color: var(--slate-500); margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--slate-900); line-height: 1.2; }
.stat-desc { font-size: 12px; color: var(--slate-400); margin-top: 6px; }

/* ===== 键值信息 ===== */
.kv-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.kv-item { background: var(--slate-50); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.kv-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--slate-500); margin-bottom: 4px; }
.kv-label svg { width: 14px; height: 14px; }
.kv-value { font-size: 15px; font-weight: 600; color: var(--slate-900); word-break: break-all; }

/* ===== 徽标 ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}
.badge.blue { background: var(--blue-100); color: var(--blue-600); }
.badge.green { background: var(--green-50); color: var(--green-700); }
.badge.orange { background: var(--orange-50); color: var(--orange-600); }
.badge.purple { background: var(--purple-50); color: var(--purple); }
.badge.red { background: var(--red-50); color: var(--red-600); }
.badge.slate { background: var(--slate-100); color: var(--slate-600); }

.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.dot.green { background: var(--green); }
.dot.red { background: var(--red); }
.dot.orange { background: var(--orange); }
.dot.slate { background: var(--slate-400); }
.dot.blue { background: var(--blue-500); }

/* ===== 表格 ===== */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-weight: 500;
  color: var(--slate-500);
  font-size: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--slate-200);
  white-space: nowrap;
  background: var(--slate-50);
}
.table th:first-child { border-top-left-radius: var(--radius-sm); }
.table th:last-child { border-top-right-radius: var(--radius-sm); }
.table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--slate-100);
  color: var(--slate-700);
  vertical-align: middle;
}
.table tbody tr:hover td { background: var(--slate-50); }
.table tbody tr:last-child td { border-bottom: none; }
.table .actions { display: flex; gap: 6px; }

/* ===== 表单 ===== */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-grid .span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; color: var(--slate-600); font-weight: 500; }
.field-hint { font-size: 12px; color: var(--slate-400); }
.field-error { font-size: 12px; color: var(--red-600); }

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--slate-800);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.input::placeholder, .textarea::placeholder { color: var(--slate-400); }
.textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 34px; }

.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--slate-700); user-select: none; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--blue-600); cursor: pointer; }

.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--blue-600); }
.range-val { min-width: 34px; text-align: center; font-weight: 600; color: var(--blue-600); }

/* ===== 空状态 / 加载 ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 16px;
  color: var(--slate-400);
  font-size: 13px;
  text-align: center;
}
.empty-state .icon { color: var(--slate-300); }
.empty-state .icon svg { width: 32px; height: 32px; }

.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 32px; color: var(--slate-400); font-size: 13px; }

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--slate-200);
  border-top-color: var(--blue-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 进度条 ===== */
.progress { height: 8px; background: var(--slate-100); border-radius: 6px; overflow: hidden; min-width: 90px; }
.progress-bar {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #3b82f6, #2563eb);
  transition: width 0.3s ease;
}
.progress-bar.green { background: linear-gradient(90deg, #34d399, #10b981); }
.progress-bar.red { background: linear-gradient(90deg, #f87171, #ef4444); }
.progress-bar.orange { background: linear-gradient(90deg, #fbbf24, #f59e0b); }

/* ===== 日志查看器 ===== */
.log-view {
  background: var(--slate-900);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  height: 320px;
  overflow-y: auto;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
  line-height: 1.7;
}
.log-line { color: #cbd5e1; white-space: pre-wrap; word-break: break-all; }
.log-line .ts { color: #64748b; margin-right: 8px; }
.log-line.warn { color: #fbbf24; }
.log-line.error { color: #f87171; }
.log-line.debug { color: #94a3b8; }

/* ===== Toast ===== */
.toasts {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--slate-800);
  color: #fff;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-shadow: var(--shadow-pop);
  animation: toast-in 0.28s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 80vw;
}
.toast.success { background: #065f46; }
.toast.error { background: #991b1b; }
@keyframes toast-in {
  from { transform: translateY(-24px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.18s ease;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.25);
  width: 100%;
  max-width: 420px;
  padding: 22px 24px;
  animation: modal-in 0.2s ease;
}
@keyframes modal-in { from { transform: translateY(12px) scale(0.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-title { font-size: 16px; font-weight: 600; color: var(--slate-900); margin-bottom: 8px; }
.modal-body { font-size: 14px; color: var(--slate-600); margin-bottom: 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ===== 登录 ===== */
.login-view {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
  width: 100%;
  max-width: 400px;
  padding: 32px 30px 26px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-brand .logo-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}
.login-title { font-size: 20px; font-weight: 700; color: var(--blue-800); line-height: 1.3; }
.login-sub { font-size: 12px; color: var(--slate-500); }
.login-form { margin-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.login-hint { font-size: 12px; color: var(--slate-400); line-height: 1.6; }
.login-switch { text-align: center; margin-top: 16px; font-size: 13px; }
.login-switch a { color: var(--blue-500); text-decoration: none; cursor: pointer; }
.login-switch a:hover { color: var(--blue-800); text-decoration: underline; }
.login-error {
  margin-top: 14px;
  background: var(--red-50);
  border: 1px solid var(--red-100);
  color: var(--red-600);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
}
.login-foot { margin-top: 18px; font-size: 12px; color: var(--slate-400); }

/* ===== 机器人卡片 ===== */
.bot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.bot-card {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  background: #fff;
  transition: box-shadow 0.2s, border-color 0.2s;
}
.bot-card:hover { border-color: var(--blue-100); box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1); }
.bot-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.bot-id { font-weight: 600; color: var(--slate-900); font-size: 14px; display: flex; align-items: center; gap: 8px; }
.bot-meta { font-size: 12px; color: var(--slate-500); line-height: 1.9; }
.bot-meta b { color: var(--slate-700); font-weight: 500; }
.bot-foot { display: flex; gap: 8px; margin-top: 12px; }

/* ===== 选择行 / 过滤器 ===== */
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 13px;
  color: var(--slate-600);
  background: #fff;
  border: 1px solid var(--slate-200);
  cursor: pointer;
  transition: all 0.2s;
}
.chip:hover { border-color: var(--blue-500); color: var(--blue-600); }
.chip.active { background: var(--blue-50); border-color: var(--blue-100); color: var(--blue-600); font-weight: 500; }

/* ===== 校验结果框 ===== */
.verify-box {
  margin-top: 12px;
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.verify-box.ok { background: var(--green-50); color: var(--green-700); }
.verify-box.fail { background: var(--red-50); color: var(--red-600); }

/* ===== 提示条 ===== */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: var(--blue-50);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--blue-800);
  margin-bottom: 16px;
}
.notice .icon { color: var(--blue-500); flex-shrink: 0; margin-top: 2px; }

/* ===== 响应式 ===== */
.hamburger { display: none; }

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .kv-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 99;
  }
  .main-content { margin-left: 0; }
  .stats-grid { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .content-container { padding: 16px; }
  .hamburger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--slate-600);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
  }
  .hamburger:hover { background: var(--slate-100); }
  .top-navbar { padding: 0 14px; }
  .user-details { display: none; }
}