:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --border: #e4e8ee;
  --border-strong: #d3d9e2;
  --text: #1c2430;
  --text-2: #5a6676;
  --text-3: #8a95a5;
  --accent: #0d9b57;
  --accent-soft: #e8f7ef;
  --accent-dark: #087c44;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --amber: #d98207;
  --amber-soft: #fff5e6;
  --red: #d64545;
  --red-soft: #fdecec;
  --purple: #7048c4;
  --purple-soft: #f1ecfc;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 30, 45, .04), 0 6px 20px rgba(20, 30, 45, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
  font-size: 14px; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-dark); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 20% 15%, #e9f7ef 0, transparent 45%), radial-gradient(circle at 85% 80%, #eaf1ff 0, transparent 45%), var(--bg); }
.login-card { width: 420px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: 0 16px 50px rgba(20,40,30,.10); padding: 34px; }
.login-brand { display: flex; gap: 14px; align-items: center; margin-bottom: 28px; }
.login-brand h1 { margin: 0; font-size: 22px; letter-spacing: .5px; }
.login-brand p { margin: 2px 0 0; color: var(--text-2); font-size: 12px; }
.brand-mark { width: 46px; height: 46px; border-radius: 12px; flex: none; display: grid; place-items: center;
  background: linear-gradient(135deg, #12b463, #087c44); color: #fff; font-size: 22px; font-weight: 700; }
.brand-mark.small { width: 36px; height: 36px; font-size: 17px; border-radius: 9px; }
#login-form label { display: block; margin-bottom: 16px; color: var(--text-2); font-size: 13px; }
#login-form input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--border-strong);
  border-radius: 8px; outline: none; color: var(--text); background: #fff; }
#login-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-error { color: var(--red); min-height: 20px; font-size: 13px; margin-bottom: 8px; }
.login-tip { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--border); color: var(--text-3); font-size: 12px; line-height: 1.8; }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 226px; flex: none; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.side-brand { display: flex; align-items: center; gap: 11px; padding: 20px 18px; border-bottom: 1px solid var(--border); }
.side-brand-text { display: flex; flex-direction: column; line-height: 1.35; }
.side-brand-text strong { font-size: 15px; }
.side-brand-text span { font-size: 10px; color: var(--text-3); letter-spacing: .4px; }
#nav { padding: 14px 10px; flex: 1; overflow-y: auto; }
.nav-group { font-size: 11px; color: var(--text-3); padding: 12px 10px 6px; letter-spacing: 1px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; cursor: pointer;
  color: var(--text-2); margin-bottom: 2px; transition: .15s; font-size: 13.5px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; }
.nav-item .badge { margin-left: auto; background: var(--amber-soft); color: var(--amber); font-size: 11px;
  padding: 0 6px; border-radius: 9px; font-weight: 600; }
.side-footer { padding: 14px 16px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }
.health-dot { display: flex; align-items: center; gap: 7px; }
.health-dot i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
.health-dot.bad i { background: var(--amber); }
.side-version { margin-top: 6px; opacity: .8; }
.main { flex: 1; min-width: 0; }
.topbar { height: 68px; background: var(--surface); border-bottom: 1px solid var(--border); padding: 0 26px;
  display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 10; }
.topbar h2 { margin: 0; font-size: 17px; }
.topbar p { margin: 1px 0 0; color: var(--text-3); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-2); }
.user-chip .avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--blue-soft); color: var(--blue);
  display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.content { padding: 22px 26px 50px; }

/* ---------- 通用组件 ---------- */
.btn { border: 1px solid var(--border-strong); background: #fff; color: var(--text-2); padding: 7px 14px;
  border-radius: 8px; cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; border-color: var(--accent-dark); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--red); border-color: #f0caca; }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.btn-sm { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.btn-block { width: 100%; padding: 11px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { padding: 15px 18px; border-bottom: 1px solid var(--border); display: flex;
  justify-content: space-between; align-items: center; gap: 10px; }
.card-head h3 { margin: 0; font-size: 14.5px; }
.card-head .sub { color: var(--text-3); font-size: 12px; font-weight: 400; }
.card-body { padding: 18px; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.stat { padding: 17px 18px; }
.stat .label { color: var(--text-2); font-size: 12.5px; display: flex; align-items: center; gap: 7px; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 8px; letter-spacing: -.5px; }
.stat .foot { color: var(--text-3); font-size: 11.5px; margin-top: 4px; }
.stat .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.card.stat.clickable { cursor: pointer; transition: border-color .15s, transform .15s, box-shadow .15s; }
.card.stat.clickable:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(15, 23, 42, .08); }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--accent); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 16px 18px; }
.filters label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-2); }
input, select, textarea { padding: 7px 10px; border: 1px solid var(--border-strong); border-radius: 7px;
  background: #fff; color: var(--text); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }
.filters input, .filters select { min-width: 130px; }
.filters .grow { flex: 1; min-width: 160px; }
.range-tabs { display: inline-flex; gap: 4px; }
.range-tab { padding: 6px 9px; min-width: 0; font-size: 12px; line-height: 1.2; background: #fff;
  color: var(--text-2); border: 1px solid var(--border-strong); border-radius: 6px; cursor: pointer; }
.range-tab:hover { border-color: var(--accent); color: var(--accent); }
.range-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; color: var(--text-3); font-weight: 600; padding: 10px 14px;
  background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.clickable:hover td { background: #f8fbfe; cursor: pointer; }
.table-wrap { overflow-x: auto; }
.title-cell { max-width: 420px; }
.title-cell .t { font-weight: 600; color: var(--text); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-cell .m { color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
.nowrap { white-space: nowrap; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 11.5px; line-height: 20px;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); margin: 0 4px 4px 0; }
.tag.green { background: var(--accent-soft); color: var(--accent-dark); border-color: #c8ebd7; }
.tag.blue { background: var(--blue-soft); color: var(--blue); border-color: #d3e2ff; }
.tag.amber { background: var(--amber-soft); color: var(--amber); border-color: #f5ddb2; }
.tag.red { background: var(--red-soft); color: var(--red); border-color: #f3cccc; }
.tag.purple { background: var(--purple-soft); color: var(--purple); border-color: #ded0f7; }
.tag.gray { background: #f1f3f6; color: var(--text-2); }

.heat-bar { display: inline-flex; align-items: center; gap: 7px; }
.heat-bar .track { width: 54px; height: 5px; background: #eceff4; border-radius: 4px; overflow: hidden; }
.heat-bar .fill { height: 100%; background: linear-gradient(90deg, #f0b429, #e0643a); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 13px 18px; color: var(--text-2); font-size: 12.5px; }
.empty { padding: 46px 20px; text-align: center; color: var(--text-3); }
.empty .big { font-size: 30px; margin-bottom: 8px; opacity: .5; }
.loading { padding: 40px; text-align: center; color: var(--text-3); }

/* ---------- 弹窗 / 抽屉 / Toast ---------- */
.overlay { position: fixed; inset: 0; background: rgba(18, 28, 40, .38); z-index: 50; display: flex;
  align-items: center; justify-content: center; padding: 24px; }
.modal { background: var(--surface); border-radius: 14px; width: 620px; max-width: 100%; max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: 0 24px 70px rgba(20,30,45,.22); }
.modal.wide { width: 1080px; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.close-x { cursor: pointer; color: var(--text-3); font-size: 22px; line-height: 1; border: none; background: none; }
.close-x:hover { color: var(--text); }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); }
.form-grid label.inline { flex-direction: row; align-items: center; gap: 8px; }
.form-grid textarea { min-height: 84px; resize: vertical; line-height: 1.7; }
.field-hint { color: var(--text-3); font-size: 11.5px; }

/* 分组表单：把长的任务配置切成清晰的区块，避免所有字段挤在一个平面里 */
.form-section { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 12px;
  padding: 14px 0 4px; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: none; padding-top: 0; }
.form-section-title { display: flex; align-items: baseline; gap: 10px; font-size: 13px;
  font-weight: 700; color: var(--text); }
.form-section-title .hint { font-size: 11.5px; font-weight: 400; color: var(--text-3); }
.form-section > .form-grid > label { min-width: 0; }

/* 选择网格：显式覆盖 .form-grid label 的 column 方向，杜绝复选框与文字竖排错位 */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 8px; }
.check-grid label { display: flex; flex-direction: row; align-items: center; gap: 7px;
  min-width: 0; padding: 7px 9px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface-2); font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.check-grid label:hover { border-color: var(--accent); }
.check-grid label input { flex: 0 0 auto; margin: 0; }
.check-grid label span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-grid.scrollable { max-height: 224px; overflow-y: auto; padding: 2px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.check-grid.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.form-section-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* 权威来源评估面板 */
.d-summary { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 12px 14px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2); font-size: 12.5px; }
.d-summary b { color: var(--accent); font-size: 15px; margin-right: 3px; }
.score-bar { height: 5px; margin-top: 5px; border-radius: 4px; overflow: hidden; background: var(--border); }
.score-bar i { display: block; height: 100%; background: var(--accent); }
.score-bar.low i { background: var(--amber); }
td.muted label, tr.muted td { color: var(--text-3); }

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.panel { border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.panel-head { padding: 9px 13px; background: var(--surface-2); border-bottom: 1px solid var(--border);
  font-size: 12.5px; font-weight: 600; display: flex; justify-content: space-between; }
.panel-body { padding: 14px; white-space: pre-wrap; word-break: break-word; line-height: 1.9;
  max-height: 380px; overflow-y: auto; font-size: 13.5px; }
.panel-body.editor { padding: 0; }
.panel-body textarea { width: 100%; min-height: 340px; border: none; border-radius: 0; padding: 14px;
  line-height: 1.9; resize: vertical; box-shadow: none; }
.check-list { list-style: none; padding: 0; margin: 0; }
.check-list li { padding: 9px 12px; border-bottom: 1px solid var(--border); display: flex; gap: 9px; align-items: flex-start; font-size: 12.5px; }
.check-list li:last-child { border-bottom: none; }
.check-list .pass { color: var(--accent); font-weight: 700; }
.check-list .fail { color: var(--red); font-weight: 700; }
.check-list .detail { color: var(--text-3); font-size: 11.5px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 7px 12px; font-size: 12.5px; }
.kv .k { color: var(--text-3); }
.kv .v { word-break: break-all; }

/* 改写稿图文渲染 */
.article-rich { white-space: normal; line-height: 1.95; font-size: 14px; }
.article-rich p { margin: 0 0 12px; }
.article-rich h3.article-sec { margin: 24px 0 12px; font-size: 15px; line-height: 1.5;
  color: var(--accent-dark); font-weight: 700; letter-spacing: .5px;
  border-left: 4px solid var(--accent); padding: 2px 0 2px 10px; background: var(--accent-soft);
  border-radius: 0 6px 6px 0; }
.article-rich .article-fig { margin: 14px 0; text-align: center; }
.article-rich .article-fig img { max-width: 100%; border-radius: 10px; box-shadow: 0 4px 18px rgba(0,0,0,.12); }
.article-rich .article-fig figcaption { color: var(--text-3); font-size: 12px; margin-top: 6px; }
.article-rich img { max-width: 100%; height: auto; }
.article-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.article-gallery figure { margin: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.article-gallery img { width: 100%; display: block; }
.article-gallery figcaption { padding: 7px 9px; font-size: 11.5px; color: var(--text-3); }

.toast-root { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: 8px;
  padding: 11px 16px; box-shadow: var(--shadow); font-size: 13px; min-width: 240px; max-width: 420px; }
.toast.error { border-left-color: var(--red); color: var(--red); }
.toast.warn { border-left-color: var(--amber); }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px; display: flex; gap: 10px; }
.timeline li:last-child { border: none; }
.timeline .time { color: var(--text-3); white-space: nowrap; font-size: 11.5px; }
.progress-line { display: flex; gap: 4px; flex-wrap: wrap; }
.bar-item { height: 8px; border-radius: 3px; background: var(--accent); min-width: 4px; }

/* 微信公众号自动联动：全局提示 / 配置状态 / 错误原因 */
.wechat-banner { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 10px 14px; border-radius: 10px; font-size: 13px;
  background: var(--surface-2); border: 1px solid var(--border); border-left: 4px solid var(--amber); }
.wechat-banner.warn { border-left-color: var(--red); }
.wechat-status { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); font-size: 13px; line-height: 1.7; }
.wechat-status.ok { border-left: 4px solid var(--green, var(--accent)); }
.wechat-status.warn { border-left: 4px solid var(--amber); }
.wechat-err { color: var(--red); line-height: 1.6; }
.warn-text { color: var(--amber); }
