/* 主样式 - v2 设计语言：简洁、大按钮、双模式 */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #f5f7fa;
  color: #2c3e50;
  font-size: 14px;
}

/* 页面切换 */
.page { display: none; }
.page.active { display: block; }

/* ============ 登录页 ============ */
#login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
  background: #fff;
  padding: 40px;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 360px;
}

.login-container h1 {
  font-size: 22px;
  margin-bottom: 8px;
}

.login-container .subtitle {
  color: #999;
  font-size: 13px;
  margin-bottom: 24px;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#login-form input {
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

#login-form input:focus {
  outline: none;
  border-color: #667eea;
}

#login-form button {
  padding: 12px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  font-weight: bold;
  cursor: pointer;
}

#login-form button:hover {
  opacity: 0.9;
}

.login-container .hint {
  margin-top: 16px;
  font-size: 12px;
  color: #999;
  text-align: center;
}

/* ============ 主页面布局 ============ */
#main-page {
  display: grid;
  grid-template-rows: 56px 1fr;
  grid-template-columns: 200px 1fr;
  grid-template-areas:
    "header header"
    "sidebar content";
  height: 100vh;
}

.header {
  grid-area: header;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

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

.header h1 {
  font-size: 16px;
  font-weight: 600;
}

.mode-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: bold;
  background: #e3f2fd;
  color: #1976d2;
}

.mode-badge.business {
  background: #fff3e0;
  color: #ff6f00;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#user-info {
  font-size: 13px;
  color: #666;
}

.sidebar {
  grid-area: sidebar;
  background: #fff;
  border-right: 1px solid #e8e8e8;
  padding: 16px 0;
}

.sidebar nav {
  display: flex;
  flex-direction: column;
}

.sidebar a {
  padding: 12px 20px;
  color: #555;
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}

.sidebar a:hover {
  background: #f5f7fa;
}

.sidebar a.active {
  background: #f0f4ff;
  color: #667eea;
  border-left-color: #667eea;
  font-weight: 600;
}

.content {
  grid-area: content;
  padding: 24px;
  overflow-y: auto;
}

/* ============ 按钮 ============ */
.btn-primary {
  padding: 10px 20px;
  background: #667eea;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.btn-primary:hover { background: #5568d3; }

.btn-secondary {
  padding: 8px 16px;
  background: #fff;
  color: #555;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.btn-secondary:hover {
  background: #f5f7fa;
}

.btn-danger {
  padding: 8px 16px;
  background: #f44336;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.btn-large {
  padding: 16px 32px;
  font-size: 16px;
  font-weight: bold;
}

/* ============ 卡片 ============ */
.card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
}

/* ============ 业务模式（大按钮卡片） ============ */
.business-task-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.2s;
}

.business-task-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.business-task-info h3 {
  font-size: 18px;
  margin-bottom: 6px;
}

.business-task-info p {
  color: #999;
  font-size: 13px;
}

.run-button {
  padding: 14px 32px;
  background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
}

.run-button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.run-button.running {
  background: #ff9800;
}

/* ============ 状态徽章 ============ */
.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: bold;
}

.status-badge.idle { background: #e0e0e0; color: #555; }
.status-badge.running { background: #fff3e0; color: #ff6f00; }
.status-badge.success { background: #e8f5e9; color: #4caf50; }
.status-badge.failed { background: #ffebee; color: #f44336; }
/* v2.6.32+ #171.2 manual 失败后 5min 自动重试 (橙色脉冲动画) */
.status-badge.requeue { background: #fce4ec; color: #c62828; animation: pulse-requeue 2s ease-in-out infinite; }
@keyframes pulse-requeue {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* ============ 表格 ============ */
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th, td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}

th {
  background: #fafafa;
  font-weight: 600;
  font-size: 13px;
  color: #555;
}

tr:hover {
  background: #fafafa;
}

/* ============ 表单 ============ */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 13px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #667eea;
}

/* ============ 进度条 ============ */
.progress-bar {
  height: 8px;
  background: #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
  margin: 8px 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #667eea, #764ba2);
  transition: width 0.3s;
}

/* ============ 提示信息 ============ */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  z-index: 9999;
  animation: slideIn 0.3s;
}

.toast.success { border-left: 4px solid #4caf50; }
.toast.error { border-left: 4px solid #f44336; }
.toast.info { border-left: 4px solid #2196f3; }

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

/* ============ 弹窗 ============ */
/* fix #343 (2026-08-24 19:31 - qibin 19:31 截图救命「创建任务弹窗都看不见了」):
   真正 root cause：main.css 的 .modal { display: none } 被 fix #341 引入后作用于 SPOKE 端
   SPOKE 端 modal 内容 div 用了 class="modal"，触发 main.css .modal 隐藏 → 弹窗内容看不见
   根本解法（按 qibin 19:20 救命「根本解决问题」+ #280 完全对等 + #332 K9 静态文件架构延续）:
   - main.css .modal 加 :not(.spoke-modal) 限定，只作用 v2.5.9+ 自己的 modal（v2.5.9+ 没用 .spoke-modal）
   - SPOKE 端 10 处 modal 内容 div 加 .spoke-modal class，绕过 main.css .modal 隐藏
   - 零影响 v2.5.9+ （v2.5.9+ modal 仍然走 .modal.active { display: flex } 模式）
   按 #306 数据诚实：fix #341 引入 main.css 时只看了 .toast 样式，没注意 .modal 冲突
   按 #142 v5 + qibin 19:31 救命：「创建任务弹窗都看不见了」截图直接暴露 */
.modal:not(.spoke-modal) {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  align-items: center;
  justify-content: center;
}

.modal:not(.spoke-modal).active { display: flex; }

.modal-content {
  background: #fff;
  border-radius: 8px;
  width: 90%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

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

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #999;
}