/* 燃引擎 RanEngine Web 控制台 - 简洁商务风 */
:root {
  --primary: #1f6feb;
  --primary-dark: #1158c7;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --bg: #f4f6f9;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --text: #1f2937;
  --text-muted: #6b7280;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 14px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
}

.topbar {
  background: linear-gradient(135deg, #0f2b46 0%, #1f6feb 100%);
  color: #fff;
  padding: 24px 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.brand {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 28px;
  font-weight: 700;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 1px;
}

.brand p {
  margin: 2px 0 0;
  font-size: 14px;
  opacity: 0.85;
}

.brand .demo-switch {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}

.demo-switch input {
  width: auto;
  accent-color: #fff;
}

.demo-banner {
  max-width: 1200px;
  margin: 16px auto 0;
  padding: 10px 16px;
  border: 1px solid #fde68a;
  border-radius: 10px;
  background: #fff8eb;
  color: #92400e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  font-weight: 600;
}

.demo-banner.hidden {
  display: none;
}

.btn-sm {
  min-height: 30px;
  padding: 4px 10px;
  font-size: 13px;
}

.container {
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 18px;
  color: #111827;
  border-left: 4px solid var(--primary);
  padding-left: 10px;
}

.api-card {
  grid-column: 1 / -1;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.row label {
  min-width: 80px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 14px;
}

.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fcfcfd;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
  background: #fff;
}

textarea {
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: #f0f7ff;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

.hint {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.hint.warning {
  color: var(--warning);
  background: #fff8eb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 12px;
}

.hint.success {
  color: #2e7d32;
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
  border-radius: 8px;
  padding: 10px 12px;
}

.result {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #f9fafb;
  border: 1px solid var(--border);
  font-size: 13px;
  max-height: 360px;
  overflow: auto;
  word-break: break-word;
}

.result.empty {
  color: var(--text-muted);
}

.result.error {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--danger);
}

.result.success {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.result pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}

.counts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 4px;
}

.count-item {
  flex: 1 1 120px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.count-item .num {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
}

.count-item .label {
  font-size: 13px;
  color: var(--text-muted);
}

.template-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.template-list li {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  background: #fff;
}

.template-list .tpl-name {
  font-weight: 700;
}

.template-list .tpl-industry {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: 12px;
}

.template-list .tpl-files {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
  color: var(--text-muted);
}

.footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  padding: 20px;
}

@media (max-width: 640px) {
  .brand h1 {
    font-size: 20px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    font-size: 22px;
  }

  .container {
    padding: 0 12px;
  }

  .btn {
    width: 100%;
  }
}


/* ---------- 登录页与整体显隐 ---------- */
.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.login-page {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #0f2b46 0%, #1f6feb 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  padding: 36px 32px;
}

.login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.login-brand .brand-mark {
  width: 56px;
  height: 56px;
  font-size: 30px;
  margin: 0 auto 12px;
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.login-brand h1 {
  margin: 0;
  font-size: 24px;
  color: #111827;
}

.login-brand p {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 14px;
}

.login-error {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  font-size: 13px;
}

.login-tip {
  margin: 20px 0 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.login-tip code {
  padding: 2px 6px;
  background: #f3f4f6;
  border-radius: 6px;
  color: #374151;
}

.btn-block {
  width: 100%;
}

.btn-logout {
  margin-left: 4px;
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.btn-logout:hover {
  border-color: #fff;
  color: #fff;
  background: rgba(255, 255, 255, 0.22);
}

/* ---------- 真实业务数据模块 ---------- */
.summary-card {
  grid-column: 1 / -1;
}

.summary-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.status-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #e5e7eb;
}

.status-label.status-loading {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.status-label.status-success {
  background: #f0fdf4;
  color: #15803d;
  border-color: #bbf7d0;
}

.status-label.status-error {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.stat-card {
  background: linear-gradient(145deg, #f8fafc 0%, #ffffff 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px 16px;
  text-align: center;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.stat-num {
  display: block;
  font-size: 38px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1.2;
}

.stat-label {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 600;
}


.login-error.success-message {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}


/* ---------- 登录页注册/登录切换 ---------- */
.login-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
}

.login-tab {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f9fafb;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.login-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-demo {
  margin-top: 10px;
  border-style: dashed;
  color: var(--primary);
  background: #f0f7ff;
}

/* ---------- 主工作台 Tab ---------- */
.tabs-nav {
  max-width: 1200px;
  margin: 16px auto 0;
  display: flex;
  gap: 8px;
  padding: 0 20px;
}

.tab-btn {
  padding: 8px 18px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.tab-btn.active {
  background: #fff;
  color: var(--primary);
  border-color: #fff;
}

.tab-page {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 20px;
}

.tab-page.hidden {
  display: none !important;
}

/* 配置表单标题 */
#tab-config h3 {
  margin: 18px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  color: #111827;
  font-size: 15px;
}

/* 移动端 Tab */
@media (max-width: 640px) {
  .tabs-nav {
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .tab-btn {
    white-space: nowrap;
  }
}


/* ---------- 使用帮助与价值强化 ---------- */
.btn-help {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.btn-help:hover {
  border-color: #fff;
  color: #fff;
  background: rgba(255, 255, 255, 0.24);
}

.login-value {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #eff6ff;
  color: #1e40af;
}

.login-value-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
}

.login-value ul {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.8;
}

.field-help {
  margin: 5px 0 0;
  font-size: 12px;
  color: var(--text-muted);
}

.guide-card {
  grid-column: 1 / -1;
}

.guide-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.guide-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fafc;
}

.guide-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
}

.guide-step strong {
  display: block;
  margin-bottom: 2px;
  font-size: 14px;
}

.guide-step p {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}

.value-card {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #f0f7ff 0%, #ffffff 100%);
}

.value-list {
  margin: 0;
  padding-left: 20px;
}

.value-list li {
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.7;
}

.value-list strong {
  color: var(--primary);
}

.help-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.help-modal.hidden {
  display: none !important;
}

.help-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 43, 70, 0.55);
  backdrop-filter: blur(2px);
}

.help-panel {
  position: relative;
  width: 100%;
  max-width: 760px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}

.help-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: linear-gradient(135deg, #0f2b46 0%, #1f6feb 100%);
  color: #fff;
}

.help-panel-header h2 {
  margin: 0;
  font-size: 20px;
}

.help-panel-body {
  padding: 20px;
  overflow-y: auto;
}

.help-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.help-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.help-section h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--primary-dark);
}

.help-section ol,
.help-section ul {
  margin: 0;
  padding-left: 20px;
}

.help-section li {
  margin-bottom: 5px;
  font-size: 14px;
  line-height: 1.7;
}

.help-section pre {
  margin: 0 0 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 640px) {
  .guide-steps {
    grid-template-columns: 1fr;
  }

  .help-panel {
    max-height: 92vh;
  }
}

/* ---------- 任务看板 ---------- */
.table-wrap {
  overflow-x: auto;
  margin-top: 8px;
}

.tasks-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}

.tasks-table th,
.tasks-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.tasks-table th {
  background: #f8fafc;
  color: #374151;
  font-weight: 700;
  white-space: nowrap;
}

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

.task-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.task-status.queued {
  background: #f3f4f6;
  color: #4b5563;
}

.task-status.running {
  background: #eff6ff;
  color: #1d4ed8;
}

.task-status.success {
  background: #f0fdf4;
  color: #15803d;
}

.task-status.failed {
  background: #fef2f2;
  color: #b91c1c;
}

.task-status.retry {
  background: #fffbeb;
  color: #b45309;
}

.task-status.skipped {
  background: #f5f3ff;
  color: #6d28d9;
}

.tasks-summary {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ===== 协作看板 ===== */
.board-projects { display: flex; flex-wrap: wrap; gap: 14px; padding: 8px 0; }
.project-card {
  border: 1px solid #ddd; border-radius: 10px; padding: 14px 16px; width: 240px;
  background: #fff; cursor: pointer; transition: box-shadow .15s, transform .15s;
}
.project-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.12); transform: translateY(-2px); }
.project-card h3 { margin: 0 0 6px; font-size: 15px; color: #333; }
.project-card .pc-meta { font-size: 12px; color: #888; margin-bottom: 8px; }
.project-card .pc-counts { display: flex; gap: 8px; font-size: 12px; }
.project-card .pc-counts span { background: #f2f4f7; padding: 2px 8px; border-radius: 20px; }
.project-card .pc-counts .todo { color: #c0392b; }
.project-card .pc-counts .doing { color: #2980b9; }
.project-card .pc-counts .done { color: #27ae60; }
.board-columns { display: flex; gap: 14px; margin-top: 12px; align-items: flex-start; }
.board-col {
  flex: 1; min-width: 220px; background: #f7f8fa; border-radius: 10px; padding: 10px;
  min-height: 200px; border: 1px dashed transparent;
}
.board-col.dragover { border-color: #2980b9; background: #eef5fb; }
.board-col h4 { margin: 4px 6px 8px; font-size: 14px; color: #555; }
.board-task {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 10px;
  margin-bottom: 8px; font-size: 13px; cursor: grab; transition: box-shadow .12s;
}
.board-task:hover { box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.board-task.dragging { opacity: .5; }
.board-task .bt-title { font-weight: 600; color: #333; margin-bottom: 4px; }
.board-task .bt-tags { font-size: 11px; color: #7a8; }
.board-task .bt-tags span { background: #eef2ff; color: #4a5bd0; padding: 1px 6px; border-radius: 10px; margin-right: 4px; }
.board-activity { margin-top: 16px; font-size: 12px; color: #888; border-top: 1px solid #eee; padding-top: 10px; }
.board-activity div { padding: 2px 0; }
.board-activity .actor { color: #555; font-weight: 600; }

/* ===== 企业微信联系人/群成员 ===== */
.wecom-contacts { margin-top: 8px; font-size: 13px; }
.wecom-contacts .wc-item { display: flex; justify-content: space-between; align-items: center; background: #f7f8fa; border-radius: 6px; padding: 6px 10px; margin: 4px 0; }
.wecom-contacts .wc-item .wc-name { font-weight: 600; color: #333; }
.wecom-contacts .wc-item .wc-id { color: #888; font-family: monospace; font-size: 12px; }
.wecom-contacts .wc-item button { font-size: 11px; padding: 2px 8px; }
.wecom-contacts .wc-title { font-weight: 600; color: #555; margin: 10px 0 4px; }
.wecom-contacts .wc-members { margin-left: 14px; color: #777; font-size: 12px; }
