/* WorldQuant 量化研究监控平台 - DESIGN.md 样式系统 */

/* ==================== CSS 变量设计系统 ==================== */
:root {
  /* 主色调 */
  --primary: #111111;
  --primary-dark: #242424;
  --primary-light: #374151;
  --secondary: #111111;
  
  /* 功能色 */
  --success: #10b981;
  --success-light: #dcfce7;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --info: #3b82f6;
  --info-light: #dbeafe;
  
  /* 中性色 */
  --gray-50: #f8f9fa;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #898989;
  --gray-600: #6b7280;
  --gray-700: #374151;
  --gray-800: #242424;
  --gray-900: #111111;
  
  /* 背景色 */
  --bg-primary: #ffffff;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f8f9fa;
  
  /* 阴影 */
  --shadow-sm: 0 1px 2px rgba(17, 17, 17, 0.04);
  --shadow-md: 0 8px 24px rgba(17, 17, 17, 0.06);
  --shadow-lg: 0 16px 40px rgba(17, 17, 17, 0.08);
  --shadow-xl: 0 24px 64px rgba(17, 17, 17, 0.12);
  
  /* 圆角 */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  
  /* 间距 */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;
  
  /* 过渡 */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
  
  /* 字体 */
  --font-sans: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Cal Sans', Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Monaco, Menlo, Consolas, monospace;
  
  /* Z-index 层级 */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
}

/* ==================== 暗色主题 ==================== */
[data-theme="dark"] {
  --primary: #ffffff;
  --primary-dark: #e5e7eb;
  --bg-primary: #0f1419;
  --bg-secondary: #1a1f2e;
  --bg-tertiary: #252b3d;
  --gray-50: #252b3d;
  --gray-100: #2d3348;
  --gray-200: #3d4460;
  --gray-300: #4d5578;
  --gray-700: #c9d1d9;
  --gray-800: #e6edf3;
  --gray-900: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ==================== 全局基础样式 ==================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--gray-900);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-base), color var(--transition-base);
}

#app {
  min-height: 100vh;
}

main {
  display: grid;
  gap: var(--spacing-lg);
}

section {
  background: var(--bg-secondary);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--spacing-xl);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

section:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow-md);
}

section h2 {
  align-items: center;
  border: 0;
  color: var(--gray-900);
  display: flex;
  font-size: 18px;
  font-weight: 600;
  gap: var(--spacing-sm);
  letter-spacing: 0;
  margin: 0 0 var(--spacing-md) 0;
  padding: 0;
}

/* 进度条 */
.progress-bar {
  background: var(--gray-200);
  border-radius: var(--radius-full);
  height: 24px;
  overflow: hidden;
  margin-bottom: var(--spacing-md);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
}

.progress-fill {
  background: var(--primary);
  height: 100%;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.progress-fill::after { display: none; }

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Alpha表格 */
.alphas-table table {
    width: 100%;
    border-collapse: collapse;
}

.alphas-table th, .alphas-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.alphas-table th {
    background: var(--gray-50);
    color: var(--gray-600);
}

.alphas-table tr:hover {
    background: #f8f9fa;
}

/* 按钮样式 */
.button-group {
  display: flex;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.btn-primary, .btn-secondary, .btn-warning, .btn-success, .btn-danger {
  padding: var(--spacing-md) var(--spacing-xl);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  position: relative;
  overflow: hidden;
}

.btn-primary::after,
.btn-secondary::after,
.btn-warning::after,
.btn-success::after,
.btn-danger::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.btn-primary:active::after,
.btn-secondary:active::after,
.btn-warning:active::after,
.btn-success:active::after,
.btn-danger:active::after {
  width: 300px;
  height: 300px;
}

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: none;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  box-shadow: none;
  transform: none;
}

.btn-primary:disabled {
  background: var(--gray-400);
  cursor: not-allowed;
  box-shadow: none;
}

.btn-secondary {
  background: var(--bg-secondary);
  border: 1px solid var(--gray-200);
  color: var(--gray-900);
  box-shadow: none;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--gray-50);
  border-color: var(--gray-300);
  box-shadow: none;
  transform: none;
}

.btn-warning {
  background: var(--warning);
  color: var(--gray-900);
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.btn-warning:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 193, 7, 0.4);
}

.btn-success {
  background: var(--success);
  color: white;
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-success:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(40, 167, 69, 0.4);
}

.btn-danger {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

.btn-danger:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(220, 53, 69, 0.4);
}

.btn-sm {
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 13px;
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .main-content {
    padding: var(--spacing-md);
  }

  .stats-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .navbar {
    grid-template-columns: 1fr;
    justify-items: center;
    padding: var(--spacing-md);
  }
  
  .navbar-brand {
    margin-bottom: var(--spacing-sm);
  }
  
  .navbar-nav {
    width: 100%;
    justify-content: center;
  }
  
  .theme-toggle {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-md);
  }
  
  .main-content {
    padding: var(--spacing-sm);
  }
  
  .stats-cards {
    grid-template-columns: 1fr;
  }
  
  .button-group {
    flex-direction: column;
  }
  
  .button-group button {
    width: 100%;
  }
  
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-group {
    width: 100%;
  }
  
  .filter-group select,
  .filter-group input {
    width: 100%;
  }
  
  .data-table {
    font-size: 12px;
  }
  
  .data-table th,
  .data-table td {
    padding: var(--spacing-sm);
  }
  
  .detail-panel {
    width: 100vw;
  }
  
  section {
    padding: var(--spacing-md);
  }
}

@media (max-width: 480px) {
  .stat-card-value {
    font-size: 24px;
  }
  
  .navbar-nav a {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 13px;
  }
}

/* ==================== 导航栏样式 ==================== */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--gray-200);
  box-shadow: none;
  column-gap: var(--spacing-lg);
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(160px, 1fr);
  padding: 0 var(--spacing-xl);
  align-items: center;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  backdrop-filter: blur(12px);
}

.navbar-brand {
  color: var(--gray-900);
  font-size: 20px;
  font-family: var(--font-display);
  font-weight: 600;
  text-decoration: none;
  padding: var(--spacing-md) 0;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  transition: transform var(--transition-fast);
}

.navbar-brand:hover {
  transform: none;
}

.navbar-nav {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 6px;
  gap: 2px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-full);
}

.navbar-nav li {
  display: inline-block;
}

.navbar-nav a {
  color: var(--gray-600);
  text-decoration: none;
  padding: 8px 14px;
  display: block;
  transition: all var(--transition-fast);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  position: relative;
}

.navbar-nav a::after { display: none; }

.navbar-nav a:hover {
  color: var(--gray-900);
  background: var(--bg-secondary);
}

.navbar-nav a.active {
  color: var(--gray-900);
  background: var(--bg-secondary);
  box-shadow: var(--shadow-sm);
}

/* 主题切换按钮 */
.theme-toggle {
  background: var(--bg-secondary);
  border: 1px solid var(--gray-200);
  color: var(--gray-900);
  height: 36px;
  justify-self: end;
  padding: 0;
  border-radius: var(--radius-full);
  width: 36px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  justify-content: center;
}

.theme-toggle:hover {
  background: var(--gray-50);
  transform: none;
}

/* ==================== 筛选栏样式 ==================== */
.filter-bar {
    background: var(--bg-tertiary);
    border: 1px solid var(--gray-200);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    margin-bottom: 0;
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    align-items: center;
    box-shadow: none;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-group label {
    font-size: 13px;
    color: var(--gray-600);
    font-weight: 600;
}

.filter-group select,
.filter-group input {
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 14px;
    min-width: 120px;
    background: var(--bg-secondary);
    color: var(--gray-900);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--gray-900);
    box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.filter-group input[type="text"] {
    min-width: 150px;
}

.search-box {
    flex: 1;
    min-width: 200px;
}

.search-box input {
    width: 100%;
}

/* ==================== 分页组件样式 ==================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    flex-wrap: wrap;
    gap: 10px;
}

.pagination-info {
    color: var(--gray-600);
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pagination-controls button {
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    color: var(--gray-900);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
}

.pagination-controls button:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.pagination-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-controls button.active {
    background: var(--gray-900);
    color: white;
    border-color: var(--gray-900);
}

.pagination-controls .page-input {
    width: 60px;
    text-align: center;
}

.page-size-select {
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    margin-left: 10px;
}

/* ==================== 详情面板样式 ==================== */
.detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 500px;
    max-width: 90vw;
    height: 100vh;
    background: var(--bg-secondary);
    box-shadow: -18px 0 48px rgba(17, 17, 17, 0.12);
    z-index: var(--z-modal);
    overflow-y: auto;
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.detail-panel.open {
    transform: translateX(0);
}

.detail-panel-header {
    background: var(--gray-900);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
}

.detail-panel-header h3 {
    margin: 0;
    font-size: 18px;
}

.detail-panel-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    line-height: 1;
}

.detail-panel-close:hover {
    opacity: 0.8;
}

.detail-panel-content {
    padding: 20px;
}

.detail-section {
    margin-bottom: 20px;
}

.detail-section h4 {
    color: var(--gray-900);
    font-size: 14px;
    margin: 0 0 10px 0;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--gray-200);
}

.detail-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
}

.detail-label {
    width: 120px;
    color: var(--gray-600);
    font-size: 13px;
    flex-shrink: 0;
}

.detail-value {
    flex: 1;
    font-size: 13px;
    word-break: break-all;
}

.detail-value.code {
    font-family: 'Monaco', 'Menlo', monospace;
    background: var(--gray-50);
    padding: 10px;
    border-radius: 5px;
    font-size: 12px;
    white-space: pre-wrap;
    max-height: 300px;
    overflow-y: auto;
}

/* ==================== 模板状态标签 ==================== */
.template-status {
    display: inline-block;
    padding: 5px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
}

.template-status.effective {
    background: var(--success-light);
    color: #166534;
}

.template-status.blacklisted {
    background: var(--danger-light);
    color: #991b1b;
}

.template-status.normal {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* 统计卡片 */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--spacing-md);
  margin-bottom: 0;
}

.stat-card {
  background: var(--gray-50);
  padding: var(--spacing-lg);
  border-radius: var(--radius-lg);
  box-shadow: none;
  text-align: left;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  border: 1px solid var(--gray-200);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  display: none;
}

.stat-card:hover {
  border-color: var(--gray-300);
  box-shadow: var(--shadow-sm);
  transform: none;
}

.stat-card-value {
  font-size: 32px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: var(--spacing-xs);
  line-height: 1.2;
}

.stat-card-label {
  color: var(--gray-600);
  font-size: 14px;
  font-weight: 500;
}

/* ==================== 表格样式扩展 ==================== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: none;
    border: 1px solid var(--gray-200);
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.data-table th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.data-table th:hover {
    background: var(--gray-100);
}

.data-table th.sortable::after {
    content: ' ↕';
    opacity: 0.5;
    font-size: 11px;
}

.data-table th.sort-asc::after {
    content: ' ↑';
    opacity: 1;
}

.data-table th.sort-desc::after {
    content: ' ↓';
    opacity: 1;
}

.data-table tbody tr {
    cursor: pointer;
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table tbody tr.selected {
    background: var(--gray-100);
}

.data-table .truncate {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ==================== 遮罩层 ==================== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

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

/* ==================== 空数据提示 ==================== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-500);
}

.empty-state-icon {
    font-family: var(--font-mono);
    font-size: 28px;
    margin-bottom: 15px;
}

/* ==================== 监控台新版布局 ==================== */
.monitor-nav {
  background: #101827;
  box-shadow: none;
}

.monitor-nav .navbar-brand {
  gap: 10px;
}

.brand-muted {
  color: #9fb0c8;
  font-size: 14px;
  font-weight: 600;
}

.monitor-shell {
  background: #f3f6fb;
  display: block;
  max-width: 1480px;
  margin: 0 auto;
  min-height: calc(100vh - 56px);
  padding: 24px;
  width: 100%;
}

[data-theme="dark"] .monitor-shell {
  background: #0f1419;
}

[data-theme="dark"] .content-panel h2,
[data-theme="dark"] .panel-heading strong {
  color: #f8fafc;
}

.monitor-grid {
  display: grid;
  gap: var(--spacing-md);
  grid-template-columns: minmax(0, 1.8fr) minmax(360px, 1fr);
  margin-bottom: 0;
}

.monitor-grid.lower {
  grid-template-columns: minmax(360px, 0.85fr) minmax(0, 1.15fr);
}

.panel-heading {
  align-items: flex-start;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-heading.compact {
  align-items: center;
}

.panel-heading h2 {
  border: 0;
  color: #0f172a;
  font-size: 18px;
  margin: 0;
  padding: 0;
}

.panel-heading p {
  color: #64748b;
  font-size: 13px;
  margin-top: 4px;
}

.panel-heading > span,
.panel-heading > strong {
  color: #334155;
  flex: 0 0 auto;
  font-size: 13px;
}

.panel-heading > strong {
  font-size: 26px;
}

.hourly-chart {
  height: 320px;
}

.progress-bar.slim {
  height: 12px;
  margin: 16px 0 10px;
}

.workflow-meta {
  color: #64748b;
  display: flex;
  font-size: 13px;
  justify-content: space-between;
}

.queue-summary {
  border-top: 1px solid #e2e8f0;
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
}

.queue-row {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 92px 1fr;
}

.queue-row strong,
.queue-row span {
  display: block;
}

.queue-row strong {
  color: #0f172a;
  font-size: 14px;
}

.running-text {
  color: #16a34a;
  font-size: 12px;
}

.muted-text {
  color: #64748b;
  font-size: 13px;
}

.queue-counts {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(4, 1fr);
}

.queue-counts span {
  background: #f3f6fb;
  border-radius: 6px;
  color: #475569;
  font-size: 12px;
  padding: 7px 8px;
  text-align: center;
}

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

.alpha-stats div {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
}

.alpha-stats span,
.alpha-stats b {
  display: block;
}

.alpha-stats span {
  color: #64748b;
  font-size: 12px;
}

.alpha-stats b {
  color: #0f172a;
  font-size: 22px;
  margin-top: 4px;
}

.status-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.status-chip {
  background: #e2e8f0;
  border-radius: 999px;
  color: #334155;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 7px 10px;
}

.status-chip.success {
  background: #dcfce7;
  color: #166534;
}

.status-chip.failed {
  background: #fee2e2;
  color: #991b1b;
}

.status-chip.running {
  background: #fef3c7;
  color: #92400e;
}

.status-chip.warning {
  background: #e0e7ff;
  color: #3730a3;
}

.activity-list {
  display: grid;
  gap: 10px;
}

.activity-item {
  align-items: center;
  border-bottom: 1px solid #edf1f7;
  display: grid;
  gap: 12px;
  grid-template-columns: 10px minmax(0, 1fr) 64px;
  padding-bottom: 10px;
}

.activity-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.activity-mark {
  border-radius: 50%;
  height: 8px;
  width: 8px;
}

.activity-mark.success {
  background: #22c55e;
}

.activity-mark.failed {
  background: #ef4444;
}

.activity-mark.running {
  background: #f59e0b;
}

.activity-mark.default {
  background: #94a3b8;
}

.activity-item strong {
  color: #0f172a;
  display: block;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-item p {
  color: #64748b;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-item time {
  color: #94a3b8;
  font-size: 12px;
  text-align: right;
}

.table-panel,
.logs-panel {
  margin-bottom: 0;
}

.table-wrap {
  overflow-x: auto;
}

.expression-cell {
  max-width: 520px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost-button {
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #334155;
  cursor: pointer;
  font-weight: 700;
  padding: 8px 12px;
}

.ghost-button:hover {
  background: #f8fafc;
}

.log-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.log-actions select {
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #334155;
  padding: 8px 10px;
}

.log-viewer-clean {
  background: #0f172a;
  border-radius: 8px;
  color: #cbd5e1;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  max-height: 360px;
  overflow: auto;
  padding: 14px;
}

.log-line {
  display: grid;
  gap: 10px;
  grid-template-columns: 138px 64px 150px minmax(0, 1fr);
  padding: 2px 0;
}

.log-line time {
  color: #94a3b8;
}

.log-level {
  font-weight: 800;
}

.log-level.INFO {
  color: #60a5fa;
}

.log-level.WARNING {
  color: #fbbf24;
}

.log-level.ERROR,
.log-level.CRITICAL {
  color: #f87171;
}

.empty-line {
  color: #94a3b8;
  font-size: 13px;
  padding: 12px 0;
}

@media (max-width: 1180px) {
  .monitor-grid,
  .monitor-grid.lower {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .monitor-shell {
    padding: 12px;
  }

  .alpha-stats {
    grid-template-columns: 1fr 1fr;
  }

  .queue-row {
    grid-template-columns: 1fr;
  }

  .queue-counts {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel-heading {
    flex-direction: column;
  }

  .log-line {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

.empty-state-text {
    font-size: 16px;
}

/* ==================== Alpha状态颜色 ==================== */
.alpha-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.alpha-status.created { background: #e2e3e5; color: #383d41; }
.alpha-status.simulated { background: #cce5ff; color: #004085; }
.alpha-status.qualified { background: #fff3cd; color: #856404; }
.alpha-status.submitted { background: #d1ecf1; color: #0c5460; }
.alpha-status.accepted { background: #d4edda; color: #155724; }
.alpha-status.is_failed { background: #f8d7da; color: #721c24; }

/* ==================== 导航链接样式（别名） ==================== */
.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 15px 20px;
    display: block;
    transition: all 0.3s;
    border-radius: 5px;
    font-weight: 500;
}

.nav-link:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.2);
}

/* ==================== 分页项样式 ==================== */
.page-item {
    display: inline-block;
}

/* ==================== DESIGN.md 统一页面覆盖 ==================== */
.main-content {
  background: var(--bg-primary);
  display: grid;
  gap: var(--spacing-md);
  max-width: 1480px;
  margin: 0 auto;
  min-height: calc(100vh - 64px);
  padding: 24px;
  width: 100%;
}

.content-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 18px;
}

.content-panel > .panel-heading {
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: var(--spacing-md);
  padding-bottom: var(--spacing-md);
}

.alphas-table {
  overflow-x: auto;
}

.monitor-nav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--gray-200);
}

.monitor-shell {
  background: var(--bg-primary);
  display: grid;
  gap: var(--spacing-md);
}

.workflow-meta,
.muted-text,
.panel-heading p,
.alpha-stats span,
.activity-item p {
  color: var(--gray-600);
}

.content-panel,
.alpha-stats div {
  background: var(--bg-secondary);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.stat-card strong,
.panel-heading h2,
.panel-heading > strong,
.queue-row strong,
.alpha-stats b,
.activity-item strong {
  color: var(--gray-900);
}

.stat-card span {
  color: var(--gray-600);
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-top: var(--spacing-xs);
}

.stat-card strong {
  display: block;
  font-size: 32px;
  font-weight: 600;
  line-height: 1.2;
}

.queue-summary {
  border-color: var(--gray-200);
}

.queue-counts span {
  background: var(--gray-50);
  border-radius: var(--radius-md);
  color: var(--gray-700);
}

.activity-item {
  border-bottom-color: var(--gray-100);
}

.ghost-button,
.log-actions select {
  background: var(--bg-secondary);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  color: var(--gray-900);
}

.ghost-button:hover {
  background: var(--gray-50);
}

.log-viewer-clean {
  background: var(--gray-900);
  border-radius: var(--radius-lg);
}

.alpha-status {
  border-radius: var(--radius-full);
  font-weight: 700;
  padding: 5px 10px;
}

.alpha-status.created { background: var(--gray-100); color: var(--gray-700); }
.alpha-status.simulated { background: var(--info-light); color: #1d4ed8; }
.alpha-status.qualified { background: var(--warning-light); color: #92400e; }
.alpha-status.submitted { background: #ecfeff; color: #0e7490; }
.alpha-status.accepted { background: var(--success-light); color: #166534; }
.alpha-status.is_failed { background: var(--danger-light); color: #991b1b; }

.nav-link {
  color: var(--gray-600);
}

.nav-link:hover,
.nav-link.active {
  background: var(--bg-secondary);
  color: var(--gray-900);
}

@media (max-width: 768px) {
  .main-content,
  .monitor-shell {
    padding: 12px;
  }

}

.page-link {
    padding: 8px 12px;
    border: 1px solid var(--gray-200);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
    text-decoration: none;
    color: var(--gray-900);
    display: inline-block;
}

.page-link:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.page-link:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-item.active .page-link {
    background: var(--gray-900);
    color: white;
    border-color: var(--gray-900);
}

/* ==================== 详情面板头部/内容（别名） ==================== */
.detail-header {
    background: var(--gray-900);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
}

.detail-header h3 {
    margin: 0;
    font-size: 18px;
}

.detail-body {
    padding: 20px;
}

/* ==================== 状态标签（badge变体） ==================== */
.badge-effective {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    background: var(--success-light);
    color: #166534;
}

.badge-blacklisted {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    background: var(--danger-light);
    color: #991b1b;
}

.badge-normal {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    background: var(--gray-100);
    color: var(--gray-700);
}

/* ==================== 加载状态 ==================== */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: var(--gray-600);
}

.loading-spinner::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--gray-900);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ==================== 表格行点击高亮 ==================== */
.data-table tbody tr:active {
    background: var(--gray-100);
}
