:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --border: #e4e6ea;
  --text: #1f2329;
  --muted: #6b7280;
  --primary: #534ab7;
  --primary-soft: #eeedfe;
  --ok: #0f6e56;
  --warn: #b86e00;
  --danger: #a32d2d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 200px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  flex-shrink: 0;
}

.brand {
  font-weight: 600;
  font-size: 15px;
  padding: 4px 10px 18px;
}

.nav-item {
  display: block;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
}

.nav-item.active { background: var(--primary-soft); color: var(--primary); }

.content { flex: 1; padding: 24px 28px; }

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

.topbar h1 { font-size: 20px; font-weight: 600; margin: 0; }

.status-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  color: var(--muted);
}

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }
.status-pill.ok .dot { background: var(--ok); }
.status-pill.down .dot { background: var(--danger); }

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.card-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.card-value { font-size: 30px; font-weight: 600; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

.panel h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
.muted { color: var(--muted); font-size: 14px; line-height: 1.6; }

/* 表格 */
table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.grid th, table.grid td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

table.grid th { color: var(--muted); font-weight: 500; }

/* 状态标签 */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}
.badge.ok { background: #e3f4ec; color: var(--ok); }
.badge.warn { background: #fdf1df; color: var(--warn); }
.badge.danger { background: #fbe4e4; color: var(--danger); }
.badge.muted { background: #eef0f2; color: var(--muted); }

/* 审核区块（文章详情弹窗） */
.audit-box {
  margin: 10px 0 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--muted);
  border-radius: 8px;
  background: var(--surface);
  font-size: 13px;
  line-height: 1.7;
}
.audit-box.audit-pass { border-left-color: var(--ok); background: #f6fbf9; }
.audit-box.audit-review { border-left-color: var(--warn); background: #fffaf1; }
.audit-box.audit-reject { border-left-color: var(--danger); background: #fdf5f5; }
.audit-box.audit-pending { border-left-color: var(--muted); background: #fafbfc; }
.audit-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 6px; }
.audit-line { margin: 4px 0; }
.audit-evidence { margin: 4px 0 0; padding-left: 18px; color: var(--muted); }
.audit-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
/* 审核被拦提示 / 操作结果回显 / 从任务页跳入时的高亮 */
.audit-hint { color: var(--warn, #b45309); font-weight: 600; }
.audit-flash {
  margin: 8px 0 0;
  padding: 7px 10px;
  border-radius: 6px;
  background: #eef7f2;
  color: #1f7a4d;
  border: 1px solid #cbe8da;
}
.audit-box.audit-focus { box-shadow: 0 0 0 3px var(--primary-soft); transition: box-shadow .3s; }
/* 表格内文字超链接（看原文 / 源站） */
a.link { color: var(--primary); text-decoration: none; white-space: nowrap; margin-left: 4px; }
a.link:hover { text-decoration: underline; }
/* 审核拦截导致的失败原因用醒目色，与普通失败区分 */
.audit-blocked-text { color: var(--danger); }

/* 任务表：列宽收敛，避免 8 列把 nid / 标题挤成竖排 */
.task-nid { max-width: 132px; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.task-title { max-width: 230px; }
.task-stage { white-space: nowrap; }
.task-audit { min-width: 104px; white-space: nowrap; }
.task-err { max-width: 120px; }
.task-time { white-space: nowrap; font-size: 12px; }
.task-ops { min-width: 176px; white-space: normal; }
.task-ops .btn { margin: 0 4px 4px 0; white-space: nowrap; }

/* 表单与按钮 */
.form { display: flex; gap: 10px; flex-wrap: wrap; }
.form input, .form select {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  flex: 1;
  min-width: 150px;
  background: #fff;
}

/* 面板内选择器（下拉） */
select {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  margin-right: 8px;
  background: #fff;
}

/* 超长文本省略 */
.ellipsis {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.danger { color: var(--danger); border-color: #f0c4c4; }
.btn.sm { padding: 4px 10px; font-size: 12px; margin-right: 4px; }

/* 垂直表单 */
.form-vertical { display: flex; flex-direction: column; gap: 14px; max-width: 560px; }
.form-vertical .field { display: flex; flex-direction: column; gap: 6px; }
.form-vertical .field-row { display: flex; gap: 14px; }
.form-vertical .field-row .field { flex: 1; }
.form-vertical label { font-size: 13px; color: var(--muted); }
.form-vertical input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}
.form-vertical .btn { align-self: flex-start; margin-top: 4px; }

/* 工具栏与文本域 */
.toolbar { margin-bottom: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  min-width: 200px;
  background: #fff;
}
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  resize: vertical;
  margin-bottom: 10px;
  background: #fafbfc;
}

/* ===== 文章详情弹窗 ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}
.modal-box {
  position: relative;
  background: var(--surface);
  border-radius: 14px;
  width: min(820px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-head h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 标题很长时右侧按钮不被压缩（避免「关闭」竖排） */
.modal-head > .btn { flex-shrink: 0; white-space: nowrap; margin-left: 12px; }
.modal-body {
  padding: 18px 22px;
  overflow-y: auto;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 13px;
}
.article-meta a { color: var(--primary); }

.article-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.9;
  color: var(--text);
  margin: 0;
}
.article-error {
  background: #fbe4e4;
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}

.article-images-title { font-size: 14px; font-weight: 600; margin: 20px 0 10px; }
.article-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  padding-bottom: 8px;
}
.article-images img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f0f1f3;
  display: block;
}
.article-images a { display: block; }
