/* ============================================================
   极域AI · 猎犬座 CVn — GEO 监控系统 (Apple-inspired UI)
   ============================================================ */

:root {
  /* === 背景色系（向旧变量名兼容） === */
  --bg-primary: #f5f5f7;        /* 页面画布 */
  --bg-secondary: #fafafa;      /* 次级背景 */
  --bg-card: #ffffff;           /* 卡片 */
  --bg-hover: #f5f5f7;
  --bg-elevated: #ffffff;

  /* === 文字色系 === */
  --text-primary: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-muted: #86868b;

  /* === 强调色 — Apple Blue === */
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-active: #006edb;
  --accent-light: #e8f2fd;
  --accent-soft: rgba(0, 113, 227, 0.08);

  /* === 状态色（Apple System Colors） === */
  --success: #34c759;
  --success-bg: rgba(52, 199, 89, 0.12);
  --warning: #ff9500;
  --warning-bg: rgba(255, 149, 0, 0.12);
  --danger: #ff3b30;
  --danger-bg: rgba(255, 59, 48, 0.12);

  /* === 边框 === */
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.14);

  /* === 阴影 === */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 24px 60px rgba(0, 0, 0, 0.12), 0 8px 24px rgba(0, 0, 0, 0.06);

  /* === 圆角 === */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --sidebar-width: 240px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text',
    'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  font-size: 14px;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   登录页
   ============================================================ */
.login-page {
  display: flex;
  min-height: 100vh;
}

.login-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: linear-gradient(135deg, #fbfbfd 0%, #f0f0f5 100%);
  padding: 40px;
  position: relative;
  overflow: hidden;
}

.login-left::before,
.login-left::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.login-left::before {
  width: 620px;
  height: 620px;
  background: radial-gradient(circle, rgba(0, 113, 227, 0.10) 0%, transparent 70%);
  top: -220px;
  right: -220px;
}

.login-left::after {
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(94, 92, 230, 0.10) 0%, transparent 70%);
  bottom: -160px;
  left: -160px;
}

.login-left h1 {
  font-size: 52px;
  font-weight: 600;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #1d1d1f 0%, #4343a0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  z-index: 1;
  letter-spacing: -0.03em;
}

.login-left p {
  color: var(--text-secondary);
  font-size: 16px;
  font-weight: 400;
  position: relative;
  z-index: 1;
}

.login-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px;
  background: #ffffff;
}

.login-box {
  width: 100%;
  max-width: 380px;
  background: transparent;
  border-radius: 0;
  padding: 0;
  border: none;
}

.login-box h2 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 6px;
  text-align: left;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.login-box .subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
}

.login-box input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-primary);
  border: 1.5px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 15px;
  margin-bottom: 12px;
  transition: all 0.2s var(--ease);
  font-family: inherit;
}

.login-box input:focus {
  outline: none;
  border-color: var(--accent);
  background: #ffffff;
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.login-box input::placeholder {
  color: var(--text-muted);
}

.login-box button {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  margin-top: 8px;
  font-family: inherit;
  letter-spacing: -0.01em;
}

.login-box button:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 113, 227, 0.28);
}

.login-box button:active:not(:disabled) {
  transform: translateY(0);
}

.login-box button:disabled {
  background: var(--text-muted);
  cursor: not-allowed;
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 14px;
  text-align: center;
  padding: 10px 14px;
  background: var(--danger-bg);
  border-radius: var(--radius-sm);
}

/* ============================================================
   主布局
   ============================================================ */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

/* === 侧边栏（毛玻璃） === */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-right: 1px solid var(--border);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-header {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header .brand-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sidebar-header h1 {
  font-size: 20px;
  font-weight: 600;
  background: linear-gradient(135deg, #1d1d1f 0%, #4343a0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.1;
}

.sidebar-header .brand-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(67, 67, 160, 0.08);
  border: 1px solid rgba(67, 67, 160, 0.18);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  color: #4343a0;
  letter-spacing: 0.02em;
  line-height: 1.5;
  white-space: nowrap;
}

.sidebar-header p {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 6px;
  letter-spacing: 0.02em;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 12px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.18s var(--ease);
  border-radius: var(--radius-md);
  margin-bottom: 2px;
  font-weight: 500;
  font-size: 14px;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-light);
  color: var(--accent);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  margin-right: 12px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}

.user-info {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent) 0%, #5e5ce6 100%);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  margin-right: 12px;
  color: white;
  box-shadow: 0 2px 8px rgba(0, 113, 227, 0.28);
}

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.logout-btn {
  width: 100%;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s var(--ease);
  font-family: inherit;
}

.logout-btn:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

/* === 主内容区 === */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 32px;
  min-height: 100vh;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h2 {
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-top: 6px;
}

/* ============================================================
   统计卡片
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border);
  transition: all 0.2s var(--ease);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.stat-card h3 {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-card .value {
  font-size: 32px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stat-card .value.success { color: var(--success); }
.stat-card .value.warning { color: var(--warning); }
.stat-card .value.danger { color: var(--danger); }

.stat-card .change {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ============================================================
   数据表格
   ============================================================ */
.data-table {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}

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

.table-filters {
  display: flex;
  gap: 10px;
}

.table-filters select,
.table-filters input {
  padding: 8px 12px;
  background: var(--bg-primary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s var(--ease);
}

.table-filters select:hover,
.table-filters input:hover {
  background: var(--bg-hover);
}

.table-filters select:focus,
.table-filters input:focus {
  outline: none;
  border-color: var(--accent);
  background: #ffffff;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 14px 24px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(245, 245, 247, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td {
  font-size: 14px;
  color: var(--text-primary);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--bg-hover);
}

/* ============================================================
   状态标签 / 按钮
   ============================================================ */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 500;
}

.status-badge.success { background: var(--success-bg); color: var(--success); }
.status-badge.warning { background: var(--warning-bg); color: var(--warning); }
.status-badge.danger  { background: var(--danger-bg);  color: var(--danger); }
.status-badge.block   {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger);
  font-weight: 600;
  position: relative;
}
.status-badge.block::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--danger);
  margin-right: 6px;
  animation: blockPulse 1.6s ease-in-out infinite;
}
@keyframes blockPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.fail-info {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--danger-bg);
  border-left: 3px solid var(--danger);
  border-radius: 4px;
  font-size: 12px;
  color: var(--danger);
  line-height: 1.5;
}
.fail-info .fail-time {
  color: var(--text-muted);
  margin-left: 6px;
}
.fail-tooltip {
  position: relative;
  cursor: help;
}
.fail-tooltip:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a1a;
  color: #fff;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 100;
  margin-bottom: 4px;
  max-width: 320px;
  white-space: normal;
  text-align: left;
  line-height: 1.5;
}

.action-btn {
  padding: 7px 14px;
  background: var(--bg-primary);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s var(--ease);
  margin-right: 8px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
}

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

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

.action-btn.primary {
  background: var(--accent);
  color: white;
}

.action-btn.primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.28);
}

/* ============================================================
   行内操作按钮组（icon + text，紧凑优雅）
   ============================================================ */
.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  justify-content: flex-end;
  vertical-align: middle;
}

.row-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease);
  font-family: inherit;
  white-space: nowrap;
  user-select: none;
}

.row-btn svg {
  width: 13px;
  height: 13px;
  stroke-width: 2;
  flex-shrink: 0;
  opacity: 0.85;
}

.row-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.row-btn:hover svg {
  opacity: 1;
}

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

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

.row-btn.danger:hover svg {
  opacity: 1;
}

.row-btn.primary {
  color: var(--accent);
}

.row-btn.primary:hover {
  background: rgba(0, 113, 227, 0.08);
  color: var(--accent-hover);
}

/* ============================================================
   平台卡片
   ============================================================ */
.platform-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.platform-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 22px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.2s var(--ease);
}

.platform-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
}

.platform-card h4 {
  font-size: 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text-primary);
}

.platform-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.platform-stat {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.platform-stat label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.platform-stat .num {
  font-size: 22px;
  font-weight: 600;
  margin-top: 4px;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.health-bar {
  height: 6px;
  background: var(--bg-primary);
  border-radius: var(--radius-full);
  margin-top: 12px;
  overflow: hidden;
}

.health-bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.4s var(--ease);
}

.health-bar-fill.high   { background: var(--success); }
.health-bar-fill.medium { background: var(--warning); }
.health-bar-fill.low    { background: var(--danger); }

/* ============================================================
   弹窗
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s var(--ease), visibility 0.22s var(--ease);
}

.modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xl);
  transform: scale(0.96) translateY(8px);
  transition: transform 0.25s var(--ease);
}

.modal-overlay.show .modal-box {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.modal-close {
  width: 32px;
  height: 32px;
  background: var(--bg-primary);
  border: none;
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.18s var(--ease);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.result-item {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
}

.result-item h4 {
  font-size: 14px;
  margin-bottom: 8px;
  font-weight: 600;
}

.result-item p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* === 任务详情：宽弹窗 + 折叠卡片 === */
.modal-box.wide {
  max-width: 1100px;
  width: 92%;
  max-height: 88vh;
  padding: 24px;
}

.task-meta {
  background: var(--bg-primary);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.9;
  color: var(--text-secondary);
}

.task-meta strong {
  color: var(--text-primary);
  margin-right: 6px;
  font-weight: 600;
}

/* 任务详情内的 platform-card 在 admin.css 中已被定义为可折叠卡片。
   两个上下文共用 .platform-card 类，但样式协调一致，无冲突。 */
.platform-card-header {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
  gap: 12px;
  transition: background 0.15s var(--ease);
  border-radius: 0;
}

.platform-card-header:hover {
  background: var(--bg-hover);
}

.platform-card-header .platform-name {
  font-weight: 600;
  font-size: 14px;
  min-width: 80px;
  color: var(--text-primary);
}

.platform-card-header .meta-summary {
  flex: 1;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.platform-card-header .meta-summary span {
  white-space: nowrap;
}

.platform-card-header .chevron {
  width: 16px;
  height: 16px;
  transition: transform 0.2s var(--ease);
  color: var(--text-muted);
}

.platform-card.expanded .chevron {
  transform: rotate(90deg);
}

.platform-card-body {
  display: none;
  border-top: 1px solid var(--border);
  padding: 0 18px 18px;
}

.platform-card.expanded .platform-card-body {
  display: block;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: 12px 0;
}

.tab-btn {
  background: transparent;
  border: none;
  padding: 10px 16px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.18s var(--ease);
  font-family: inherit;
}

.tab-btn:hover { color: var(--text-primary); }

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-pane {
  display: none;
  padding-top: 12px;
}

.tab-pane.active {
  display: block;
}

.tab-pane pre {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 420px;
  overflow-y: auto;
  margin: 0;
  color: var(--text-primary);
  font-family: 'SF Mono', 'SFMono-Regular', ui-monospace, Menlo, Monaco, Consolas, monospace;
}

.citations-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.citations-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-primary);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}

.citations-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-secondary);
}

.citations-table tr:last-child td { border-bottom: none; }

.citations-table td.idx {
  color: var(--accent);
  font-weight: 600;
  width: 40px;
}

.citations-table td.url a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}

.citations-table td.url a:hover { text-decoration: underline; }

.citations-table td.snippet {
  max-width: 320px;
  line-height: 1.6;
}

.citations-wrap {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.raw-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 8px;
}

.raw-toolbar .raw-mode-toggle {
  display: inline-flex;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.raw-toolbar .raw-mode-toggle button {
  background: transparent;
  border: none;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: all 0.18s var(--ease);
}

.raw-toolbar .raw-mode-toggle button.active {
  background: var(--accent);
  color: white;
}

.copy-btn {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.18s var(--ease);
  font-family: inherit;
}

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

/* ============================================================
   加载 / 空状态
   ============================================================ */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid var(--bg-primary);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 12px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 14px;
}

/* ============================================================
   响应式
   ============================================================ */
@media (max-width: 768px) {
  .sidebar {
    width: 60px;
  }

  .sidebar-header h1,
  .sidebar-header p,
  .nav-item span,
  .user-info > div,
  .logout-btn {
    display: none;
  }

  .nav-item {
    justify-content: center;
    padding: 14px;
  }

  .nav-item svg {
    margin-right: 0;
  }

  .user-avatar {
    margin: 0 auto;
  }

  .main-content {
    margin-left: 60px;
    padding: 20px;
  }

  .login-page {
    flex-direction: column;
  }

  .login-left,
  .login-right {
    flex: none;
    min-height: 50vh;
  }
}

/* ============================================================
   Markdown 渲染区（任务详情 - AI 回答）
   ============================================================ */
.markdown-body {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.7;
  word-wrap: break-word;
  padding: 4px 2px;
}
.markdown-body > *:first-child { margin-top: 0; }
.markdown-body > *:last-child { margin-bottom: 0; }
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  margin: 1.4em 0 0.6em;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}
.markdown-body h1 { font-size: 1.5em; padding-bottom: 0.3em; border-bottom: 1px solid var(--border); }
.markdown-body h2 { font-size: 1.3em; padding-bottom: 0.3em; border-bottom: 1px solid var(--border); }
.markdown-body h3 { font-size: 1.15em; }
.markdown-body h4 { font-size: 1em; }
.markdown-body h5 { font-size: 0.9em; color: var(--text-secondary); }
.markdown-body h6 { font-size: 0.85em; color: var(--text-muted); }
.markdown-body p { margin: 0.6em 0; }
.markdown-body ul,
.markdown-body ol { margin: 0.6em 0; padding-left: 1.6em; }
.markdown-body ul { list-style: disc; }
.markdown-body ol { list-style: decimal; }
.markdown-body li { margin: 0.25em 0; }
.markdown-body li > ul,
.markdown-body li > ol { margin: 0.25em 0; }
.markdown-body blockquote {
  margin: 0.8em 0;
  padding: 0.4em 1em;
  border-left: 3px solid var(--accent);
  background: var(--bg-secondary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-secondary);
}
.markdown-body blockquote > *:first-child { margin-top: 0; }
.markdown-body blockquote > *:last-child { margin-bottom: 0; }
.markdown-body code {
  font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
  padding: 0.15em 0.4em;
  background: var(--bg-secondary);
  border-radius: var(--radius-xs);
  color: #d4380d;
}
.markdown-body pre {
  margin: 0.8em 0;
  padding: 12px 14px;
  background: #1d1d1f;
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 13px;
  line-height: 1.5;
}
.markdown-body pre code {
  padding: 0;
  background: transparent;
  border-radius: 0;
  color: #f5f5f7;
  font-size: inherit;
}
.markdown-body a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}
.markdown-body a:hover { text-decoration: underline; }
.markdown-body table {
  margin: 0.8em 0;
  border-collapse: collapse;
  width: 100%;
  display: block;
  overflow-x: auto;
}
.markdown-body th,
.markdown-body td {
  padding: 6px 12px;
  border: 1px solid var(--border);
  text-align: left;
}
.markdown-body th { background: var(--bg-secondary); font-weight: 600; }
.markdown-body hr {
  margin: 1.2em 0;
  border: 0;
  border-top: 1px solid var(--border);
}
.markdown-body img { max-width: 100%; border-radius: var(--radius-sm); }
.markdown-body input[type="checkbox"] { margin-right: 0.4em; }

/* ============================================================
   账号管理 - 顶部平台 Tab 切换
   ============================================================ */
.platform-tabs {
  display: flex;
  gap: 8px;
  padding: 8px 4px 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.platform-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.18s var(--ease);
  white-space: nowrap;
}
.platform-tab:hover {
  border-color: rgba(0, 113, 227, 0.4);
  color: var(--text-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}
.platform-tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0, 113, 227, 0.28);
}
.platform-tab.active:hover {
  transform: none;
}
.platform-tab .tab-icon {
  font-size: 16px;
}
.platform-tab .tab-count {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  background: var(--bg-secondary);
  color: var(--text-muted);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.platform-tab.active .tab-count {
  background: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.95);
}

/* 账号详情弹窗：cookies 编辑器 */
.cookie-editor {
  width: 100%;
  min-height: 320px;
  padding: 12px 14px;
  background: #1d1d1f;
  color: #f5f5f7;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'SF Mono', Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  white-space: pre;
  overflow-x: auto;
}
.cookie-editor:focus {
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.25);
}
.cookie-editor.invalid {
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.3);
}
.detail-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 8px 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .label {
  color: var(--text-muted);
  font-weight: 500;
}
.detail-row .value {
  color: var(--text-primary);
  word-break: break-all;
}

/* ===== 分页器 ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}
.pagination:empty { display: none; }
.pagination .page-info {
  font-size: 13px;
  color: var(--text-muted);
}
.pagination .page-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pagination .page-btn {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-primary);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.pagination .page-btn:hover:not(:disabled):not(.active) {
  border-color: var(--primary);
  color: var(--primary);
}
.pagination .page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.pagination .page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination .page-ellipsis {
  padding: 0 6px;
  color: var(--text-muted);
  font-size: 13px;
}

/* ===== 选中数量徽章 ===== */
.badge-muted {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  margin-left: 4px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}
.action-btn.danger:not(:disabled) .badge-muted {
  background: rgba(220, 53, 69, 0.15);
  color: var(--danger);
}
.action-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ===== 复选框列样式微调 ===== */
.data-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  vertical-align: middle;
}
.data-table thead input[type="checkbox"] {
  margin: 0;
}
