/* 宏伊文案 */
:root {
  color-scheme: light;
  --page: #f6f6f4;
  --surface: #fcfcfb;
  --card: #ffffff;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --line: rgba(11, 11, 11, 0.10);
  --line-2: #e1e0d9;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-soft: #e8f1fc;
  --good: #0a7f0a;
  --good-soft: #e7f5e7;
  --warn: #8a5a00;
  --warn-soft: #fff4d6;
  --bad: #c0392f;
  --bad-soft: #fdecea;
  --pending: #ffe58a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 2px 8px rgba(0, 0, 0, .04);
  /* 选题冷却：一种蓝，越深越近写过（已用 dataviz 校验：单色、亮度单调） */
  --c-ok: #86b6ef;
  --c-low: #256abf;
  --c-cool: #104281;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font-size: 15px; line-height: 1.6; -webkit-text-size-adjust: 100%; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; line-height: 1.35; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.err { color: var(--bad); }
.warn { color: var(--warn); }
p.warn.card, p.err.card { padding: 10px 14px; margin: 8px 0; }
p.warn.card { background: var(--warn-soft); }
p.err.card { background: var(--bad-soft); }
.spacer { flex: 1; }
.path { font-family: ui-monospace, Consolas, monospace; font-size: 12px; color: var(--muted); word-break: break-all; }
mark.pending { background: var(--pending); color: inherit; padding: 0 2px; border-radius: 3px; }

/* 顶栏 */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px; padding: 10px 20px;
  background: rgba(252, 252, 251, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 17px; color: var(--ink); white-space: nowrap; }
.nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { padding: 6px 12px; border-radius: 8px; color: var(--ink-2); white-space: nowrap; }
.nav a:hover { background: rgba(0, 0, 0, .04); text-decoration: none; }
.nav a.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 20px 80px; }

/* 通用件 */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font: inherit; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: #f3f3f1; }
.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-ink); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.danger-ghost { color: var(--bad); }
.icon-btn { border: none; background: none; font-size: 18px; cursor: pointer; color: var(--muted); padding: 4px 8px; }
input, select, textarea { font: inherit; font-size: 15px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--ink); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { width: 100%; resize: vertical; }
.grow { flex: 1; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; background: #f0efec; color: var(--ink-2); font-size: 12px; white-space: nowrap; }
.pill.plat { background: var(--accent-soft); color: var(--accent-ink); }
.warn-pill { background: var(--warn-soft); color: var(--warn); }
.pending-pill { background: var(--pending); color: #5c4400; }
.pending-pill.zero { background: var(--good-soft); color: var(--good); }
.verdict[data-v="通过"] { background: var(--good-soft); color: var(--good); }
.verdict[data-v="通过·带灰区"] { background: #e6f4f1; color: #116b5b; }
.verdict[data-v="未通过"] { background: var(--bad-soft); color: var(--bad); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; border: 1px solid transparent; white-space: nowrap; }
.st[data-s="待核对"]::before { content: "● "; color: #d08a00; }
.st[data-s="已核对"]::before { content: "◆ "; color: var(--accent); }
.st[data-s="已发布"]::before { content: "✓ "; color: var(--good); }
.st[data-s="作废"] { color: var(--muted); text-decoration: line-through; }
.st { background: #f6f6f4; color: var(--ink-2); }
.run-st[data-s="完成"] { background: var(--good-soft); color: var(--good); }
.run-st[data-s="失败"] { background: var(--bad-soft); color: var(--bad); }
.run-st[data-s="运行中"], .run-st[data-s="排队中"] { background: var(--accent-soft); color: var(--accent-ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; font: inherit; font-size: 14px; cursor: pointer; color: var(--ink-2); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip:disabled { opacity: .35; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button { border: none; background: #fff; padding: 6px 12px; font: inherit; font-size: 14px; cursor: pointer; color: var(--ink-2); }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.seg.small button { padding: 4px 10px; font-size: 13px; }
.hint { background: var(--accent-soft); color: var(--ink-2); padding: 8px 12px; border-radius: 8px; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 6px 0; border-bottom: 1px solid #f0efec; }
.plain li:last-child { border-bottom: none; }
.kv { display: grid; grid-template-columns: 7em 1fr; gap: 6px 12px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #222; color: #fff; padding: 10px 16px;
  border-radius: 8px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 100; max-width: 90vw; font-size: 14px; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); }
.page-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.filter-row > * { flex: 1 1 160px; }
table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple th, table.simple td { text-align: left; padding: 8px; border-bottom: 1px solid #f0efec; vertical-align: top; }
table.simple th { color: var(--muted); font-weight: 500; }
.table-card { overflow-x: auto; padding: 4px 8px; }

/* 登录 */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login { width: 100%; max-width: 340px; display: grid; gap: 12px; padding: 28px; }
.login h1 { font-size: 24px; }

/* 文案库 */
.filters { display: grid; gap: 10px; }
.filters input[type=search] { width: 100%; }
.date-head { color: var(--muted); font-weight: 600; font-size: 13px; margin: 18px 0 8px; }
.lib-list { display: grid; gap: 0; }
.lib-item { display: block; color: var(--ink); margin-bottom: 8px; padding: 12px 14px; }
.lib-item:hover { text-decoration: none; border-color: var(--accent); }
.li-top { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.li-title { font-weight: 600; margin-top: 6px; font-size: 16px; }
.li-sub { margin-top: 2px; }
.empty { text-align: center; padding: 40px; }

/* 稿件页 */
.art-head { margin-bottom: 14px; }
.back { display: inline-block; margin-bottom: 6px; font-size: 14px; }
.meta-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.status-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; }
.status-bar .inline { display: inline-flex; gap: 6px; align-items: center; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tab { border: none; background: none; padding: 9px 14px; font: inherit; color: var(--ink-2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.on { color: var(--accent-ink); border-bottom-color: var(--accent); font-weight: 600; }
.sections { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.sec { margin: 0; min-width: 0; }
.sec-body { min-width: 0; overflow-x: auto; }
.md-view pre { white-space: pre-wrap; }
.sec.internal { background: #fafaf8; }
.sec-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; border-bottom: 1px dashed var(--line-2); padding-bottom: 8px; margin-bottom: 8px; }
.md-view { overflow-wrap: anywhere; }
.md-view .vditor-reset { font-size: 15px; color: var(--ink); }
.md-view table { display: block; overflow-x: auto; }
.fm-card summary { cursor: pointer; font-weight: 600; }
.fm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 12px; margin-top: 12px; }
.fm-row { display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.fm-row input[readonly] { background: #f6f6f4; color: var(--muted); }
.editor-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.editor { background: #fff; border-radius: var(--radius); }
.plain-editor { min-height: 480px; font-size: 15px; line-height: 1.7; }
.plain-editor.code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.save-bar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: 8px; align-items: center; margin-top: 12px; padding: 10px 12px; }
.findings { margin: 6px 0 10px; padding-left: 18px; font-size: 14px; }
.findings .lv-BLOCK { color: var(--bad); }
.findings .lv-RISK { color: var(--warn); }
.findings .lv-ISSUE { color: var(--warn); }
.vers { width: 100%; border-collapse: collapse; font-size: 14px; }
.vers td, .vers th { padding: 8px 6px; border-bottom: 1px solid #f0efec; text-align: left; vertical-align: top; }
.vers th { color: var(--muted); font-weight: 500; }
.vers .acts { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }

/* 运行弹窗 */
.dlg { border: none; border-radius: 14px; padding: 0; width: min(620px, 94vw); max-height: 92vh; box-shadow: 0 10px 40px rgba(0, 0, 0, .2); }
.dlg::backdrop { background: rgba(0, 0, 0, .35); }
.dlg-body { padding: 18px 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; }
.dlg-head h2 { margin: 0; }
.dlg-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.dlg-foot .muted { margin-right: auto; }
.small-dlg { width: min(360px, 92vw); }
.wide-dlg { width: min(1000px, 96vw); }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: 14px; }
.field em { font-style: normal; font-weight: 400; }
.model-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.topic-pane { margin-top: 8px; }
.topic-pane select { width: 100%; }
.picked { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; display: grid; gap: 4px; justify-items: start; }
.picked-main { font-size: 15px; }
.cands { margin-top: 6px; font-size: 14px; }
.cands summary { cursor: pointer; color: var(--accent-ink); }
.cands ol { margin: 6px 0 0; padding-left: 20px; }

/* 运行页 */
.steps { list-style: none; padding: 0; margin: 0; }
.step { padding: 10px 0; border-bottom: 1px solid #f0efec; }
.step-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.step-ic { width: 1.4em; text-align: center; font-weight: 700; }
.step[data-s="完成"] .step-ic { color: var(--good); }
.step[data-s="进行中"] .step-ic { color: var(--accent); animation: blink 1s infinite; }
.step[data-s="失败"] .step-ic { color: var(--bad); }
@keyframes blink { 50% { opacity: .3; } }
.step-detail { margin: 4px 0 0 1.9em; color: var(--ink-2); }
.step details { margin: 4px 0 0 1.9em; }
.out { white-space: pre-wrap; background: #f6f6f4; padding: 10px; border-radius: 8px; max-height: 420px; overflow: auto; font-size: 12.5px; }
.done-card { display: grid; gap: 8px; justify-items: start; background: var(--good-soft); }
.err-card { background: var(--bad-soft); }

/* 资料 */
.mat-group { margin-bottom: 22px; }
.mat-group h2 { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.mat { display: grid; gap: 4px; color: var(--ink); margin: 0; align-content: start; }
.mat:hover { text-decoration: none; border-color: var(--accent); }
.recent li { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }

/* 版本对比 */
.diff-box { overflow-x: auto; padding: 0; }
.dlg .diff-box { max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table.diff { width: 100%; border-collapse: collapse; font-family: ui-monospace, Consolas, "Microsoft YaHei", monospace; font-size: 13px; }
table.diff td { padding: 1px 6px; vertical-align: top; }
table.diff .ln { color: var(--muted); text-align: right; width: 3.5em; user-select: none; font-size: 12px; }
table.diff .sg { width: 1.2em; text-align: center; user-select: none; }
table.diff .tx { white-space: pre-wrap; word-break: break-all; }
.d-del { background: #fdecea; }
.d-ins { background: #e7f5e7; }
.d-del del { background: #f6b8b1; text-decoration: none; }
.d-ins ins { background: #a9dfa9; text-decoration: none; }
.d-skip td { color: var(--muted); background: #f6f6f4; text-align: center; font-style: italic; }
.d-del-key, .d-ins-key { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 12px; }
.d-del-key { background: #fdecea; color: var(--bad); }
.d-ins-key { background: #e7f5e7; color: var(--good); }

/* 选题 */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.tile-v { font-size: 28px; font-weight: 700; line-height: 1.2; }
.tile-l { color: var(--ink-2); font-size: 13px; }
.cov { display: grid; gap: 8px; }
.cov-row { display: grid; grid-template-columns: 8.5em 1fr 4.5em; gap: 10px; align-items: center; font-size: 14px; }
.cov-track { background: #f0efec; height: 10px; border-radius: 5px; overflow: hidden; }
.cov-bar { background: var(--accent); height: 100%; border-radius: 0 4px 4px 0; min-width: 0; }
.cov-val { text-align: right; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.mx-head { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.sw { display: inline-block; width: 16px; height: 16px; border-radius: 4px; font-style: normal; text-align: center; line-height: 14px; color: var(--muted); }
.mx-wrap { overflow: auto; max-height: 75vh; margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; }
table.mx { border-collapse: separate; border-spacing: 2px; font-size: 13px; width: 100%; }
.mx thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; padding: 8px 4px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.mx .mx-t { position: sticky; left: 0; background: var(--surface); z-index: 1; text-align: left; font-weight: 400; padding: 4px 8px;
  max-width: 300px; min-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mx thead .mx-t { z-index: 3; }
.mx .cat-row th { text-align: left; background: #f0efec; padding: 6px 8px; font-weight: 600; position: sticky; left: 0; }
.mx-c { min-width: 54px; height: 30px; text-align: center; border-radius: 4px; cursor: pointer; font-variant-numeric: tabular-nums; font-size: 12px; }
.mx-c:focus { outline: 2px solid var(--ink); outline-offset: 1px; }
.s-never { background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2); }
.s-ok { background: var(--c-ok); color: #0b0b0b; }
.s-low { background: var(--c-low); color: #fff; }
.s-cool { background: var(--c-cool); color: #fff; }
.s-na { background: transparent; color: var(--muted); cursor: default; }
.mx-c.s-na { cursor: pointer; }
.col-dim { opacity: .25; }
.tip { position: fixed; z-index: 50; background: #222; color: #fff; padding: 8px 10px; border-radius: 8px; font-size: 13px; max-width: 280px;
  pointer-events: none; opacity: 0; transition: opacity .12s; }
.tip.show { opacity: 1; }
.pop { position: fixed; z-index: 60; width: min(340px, 92vw); display: none; margin: 0; }
.pop.show { display: grid; gap: 8px; }
.pop-head { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; font-size: 14px; }

/* 手机 */
@media (max-width: 720px) {
  .top { padding: 8px 12px; gap: 6px; }
  .brand { display: none; }
  .nav a { padding: 6px 8px; font-size: 14px; }
  .wrap { padding: 14px 12px 80px; }
  h1 { font-size: 19px; }
  .dlg { width: 100vw; max-width: 100vw; max-height: 100vh; height: 100%; border-radius: 0; margin: 0; }
  .status-bar input.grow { flex-basis: 100%; }
  .kv { grid-template-columns: 5.5em 1fr; }
  .cov-row { grid-template-columns: 6.5em 1fr 3.8em; }
  .mx .mx-t { min-width: 120px; max-width: 150px; }
  .save-bar { flex-wrap: wrap; }
  .save-bar input { flex-basis: 100%; }
}
