:root {
  --navy: #16324F;
  --navy-2: #1f4368;
  --gold: #D9A441;
  --gold-soft: #f3e6c8;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --line: #e4e8ee;
  --text: #1f2937;
  --muted: #8a94a6;
  --green: #2f9e6e;
  --red: #d9534f;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif; background: var(--bg); color: var(--text); }

.layout { display: flex; min-height: 100vh; }
/* 侧边栏 */
.sidebar { width: 232px; background: var(--navy); color: #fff; display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand-logo { width: 42px; height: 42px; border-radius: 10px; background: var(--gold); color: var(--navy); font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 15px; letter-spacing: .5px; }
.brand-name { font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 11px; color: var(--gold-soft); opacity: .85; }
.nav { margin-top: 16px; display: flex; flex-direction: column; gap: 4px; }
.nav-item { text-align: left; background: transparent; border: none; color: #cdd6e3; padding: 11px 14px; border-radius: 9px; font-size: 14px; cursor: pointer; transition: .15s; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--gold); color: var(--navy); font-weight: 700; }
.sidebar-foot { margin-top: auto; font-size: 11px; color: rgba(255,255,255,.4); padding: 10px 8px 0; }

/* 主区 */
.main { flex: 1; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 18px 28px; background: var(--panel); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 19px; color: var(--navy); }
.topbar-right { display: flex; gap: 10px; align-items: center; }
.content { padding: 24px 28px; flex: 1; }

/* 卡片 */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, 1fr); }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--gold); }
.kpi .k-label { font-size: 12px; color: var(--muted); }
.kpi .k-value { font-size: 28px; font-weight: 800; color: var(--navy); margin-top: 6px; }
.kpi .k-sub { font-size: 11px; color: var(--muted); margin-top: 4px; }
.section-title { font-size: 15px; color: var(--navy); font-weight: 700; margin: 4px 0 14px; display: flex; align-items: center; gap: 8px; }
.section-title::before { content: ""; width: 6px; height: 16px; background: var(--gold); border-radius: 2px; }

/* 表格 */
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 2px solid var(--line); font-size: 12.5px; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: #fafbfc; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.tag.green { background: #e6f5ee; color: var(--green); }
.tag.red { background: #fbe9e9; color: var(--red); }
.tag.gray { background: #eef1f5; color: var(--muted); }
.tag.gold { background: var(--gold-soft); color: #9a6b12; }
.tag.blue { background: #e7eefb; color: #2c5fb3; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.dot.on { background: var(--green); }
.dot.off { background: var(--muted); }

/* 按钮 */
.btn { border: none; border-radius: 9px; padding: 9px 16px; font-size: 13.5px; cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.gold { background: var(--gold); color: var(--navy); }
.btn.ghost { background: #eef1f5; color: var(--text); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }
.btn.danger { background: #fbe9e9; color: var(--red); }
.row-actions { display: flex; gap: 6px; }

/* 工具条 */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.search { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13px; width: 240px; outline: none; }
.search:focus { border-color: var(--gold); }

/* 矩阵 */
.matrix-wrap { overflow-x: auto; }
.matrix th:first-child, .matrix td:first-child { position: sticky; left: 0; background: var(--panel); z-index: 2; min-width: 220px; }
.cell-yes { color: var(--green); font-weight: 700; }
.cell-no { color: var(--muted); }
.cell-na { color: #c4ccd8; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(20,30,45,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-mask[hidden] { display: none; }
.modal { background: #fff; width: 460px; max-width: 92vw; border-radius: 14px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { color: var(--navy); font-size: 16px; }
.modal-close { border: none; background: none; font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; }
.modal-body { padding: 18px 20px; max-height: 60vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); }
.field { margin-bottom: 13px; }
.field label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font-size: 13.5px; outline: none; font-family: inherit; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--gold); }
.field textarea { resize: vertical; min-height: 60px; }

/* toast */
.toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 20px; border-radius: 10px; font-size: 13.5px; z-index: 99; box-shadow: 0 8px 24px rgba(0,0,0,.2); }

.empty { text-align: center; color: var(--muted); padding: 40px; font-size: 13.5px; }
.muted { color: var(--muted); font-size: 12.5px; }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 22px; margin-top: 4px; }
.kv { display: flex; flex-direction: column; gap: 2px; padding: 7px 10px; background: #f7f9fc; border-radius: 8px; border: 1px solid var(--line); }
.kv .k { font-size: 11.5px; color: var(--muted); }
.kv .v { font-size: 13.5px; color: var(--text); font-weight: 600; word-break: break-all; }
pre.code { background: #0f1b2d; color: #e8eef7; padding: 14px 16px; border-radius: 10px; font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; word-break: break-all; margin: 0; }
.tbl { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 13px; }
.tbl th, .tbl td { border: 1px solid var(--line); padding: 9px 11px; text-align: left; vertical-align: top; }
.tbl th { background: #f3f6fb; color: var(--navy); font-weight: 700; }
.tbl.recon .act { color: var(--muted); font-size: 12.5px; min-width: 220px; }
.tbl.recon tr td:nth-child(4) { text-align: center; white-space: nowrap; }
.chart { margin-top: 6px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

@media (max-width: 920px) { .kpis { grid-template-columns: repeat(2, 1fr); } .sidebar { width: 64px; } .brand-text, .nav-item { font-size: 0; } .nav-item::first-letter { font-size: 14px; } }

/* 竞品对比卡片 */
.cmp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.cmp-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; background: #fff; }
.cmp-card.self { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft) inset; }
.cmp-name { font-weight: 700; color: var(--navy); font-size: 15px; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.cmp-row { display: flex; justify-content: space-between; gap: 10px; font-size: 12.5px; padding: 5px 0; border-top: 1px dashed var(--line); }
.cmp-row span { color: var(--muted); }
.cmp-row b { color: var(--text); font-weight: 600; text-align: right; }

/* 周报 */
.report-doc { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 32px; max-width: 820px; margin: 0 auto; }
.report-actions { display: flex; gap: 10px; justify-content: flex-end; margin-bottom: 16px; }
.report-head { border-bottom: 2px solid var(--navy); padding-bottom: 14px; margin-bottom: 18px; }
.report-logo { display: inline-block; background: var(--gold); color: var(--navy); font-weight: 800; padding: 3px 10px; border-radius: 6px; font-size: 13px; margin-bottom: 8px; }
.report-head h2 { color: var(--navy); font-size: 21px; }
.report-meta { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.report-kpis { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 20px; }
.rk { background: var(--bg); border-radius: 10px; padding: 12px 8px; text-align: center; }
.rk-v { font-size: 20px; font-weight: 800; color: var(--navy); }
.rk-l { font-size: 11px; color: var(--muted); margin-top: 4px; }
.report-sec { margin-bottom: 18px; }
.rs-title { font-size: 14px; font-weight: 700; color: var(--navy); margin-bottom: 10px; padding-left: 8px; border-left: 4px solid var(--gold); }
.gap-list { display: flex; flex-wrap: wrap; gap: 8px; }
.report-foot { text-align: center; color: var(--muted); font-size: 11px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

@media print {
  .sidebar, .topbar, .toast, .report-actions { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; }
  .content { padding: 0; }
  .report-doc { border: none; max-width: 100%; padding: 0; }
}

/* 内容筛选 tabs */
.filter-tabs { display: flex; gap: 8px; margin: 4px 0 14px; }
.ftab { border: 1px solid var(--line); background: #fff; color: var(--muted); padding: 6px 14px; border-radius: 20px; font-size: 13px; cursor: pointer; transition: .15s; }
.ftab:hover { border-color: var(--navy); color: var(--navy); }
.ftab.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* 自动发布 */
.pub-status .pub-row { font-size: 13px; padding: 6px 0; border-top: 1px dashed var(--line); display: flex; align-items: center; gap: 8px; }
.pub-status .pub-row:first-of-type { border-top: none; }
.pub-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.pub-dot.on { background: #2faa6b; box-shadow: 0 0 0 3px rgba(47, 170, 107, .18); }
.pub-dot.off { background: #c2c8d2; }
.ch-checks { display: flex; flex-wrap: wrap; gap: 12px; padding-top: 4px; }
.ch-check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); cursor: pointer; }
.preview-box { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.pv-title { font-size: 17px; font-weight: 800; color: var(--navy); margin-bottom: 8px; }
.pv-meta { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.pv-body { font-size: 13.5px; line-height: 1.85; color: var(--text); white-space: pre-wrap; max-height: 380px; overflow: auto; }

/* 内容查看弹窗 / 链接 */
.lk { color: var(--gold); text-decoration: none; font-weight: 600; }
.lk:hover { text-decoration: underline; }
.view-row { display: flex; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14px; }
.view-row:first-child { border-top: none; }
.view-k { flex: none; width: 72px; color: var(--muted); }
.view-v { color: var(--text); word-break: break-all; }
.view-v a { color: var(--gold); }
.view-sec { margin: 16px 0 8px; font-size: 13px; font-weight: 700; color: var(--navy); padding-left: 8px; border-left: 4px solid var(--gold); }
.view-text { font-size: 14px; line-height: 1.85; color: var(--text); white-space: pre-wrap; max-height: 320px; overflow: auto; background: var(--bg); border-radius: 8px; padding: 12px 14px; }

/* ========== 发布战报中心 ========== */
.panel-sub { font-size: 12.5px; color: var(--muted); font-weight: 400; margin-left: 10px; }
.bt-bar { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; flex-wrap: wrap; }
.bt-status { font-size: 12.5px; color: var(--muted); font-family: ui-monospace, Consolas, monospace; }
.bt-status::before { content: '●'; color: var(--gold); margin-right: 6px; font-size: 10px; vertical-align: 2px; }

.bt-console {
  background: #0f1c2e; border-radius: 12px; padding: 14px 16px; height: 340px; overflow-y: auto;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace; font-size: 12.5px; line-height: 1.85;
  border: 1px solid #1c3352;
}
.lg-line { display: flex; gap: 10px; padding: 2px 0; color: #cfe0f2; white-space: pre-wrap; word-break: break-all; }
.lg-t { color: #5f7899; flex: none; }
.lg-tag { color: #d9a441; flex: none; min-width: 78px; }
.lg-m { flex: 1; }
.lg-ok .lg-m { color: #7fd6a2; }
.lg-err .lg-m { color: #ff8f8f; }
.lg-warn .lg-m { color: #f5c877; }
.lg-step .lg-m { color: #ffffff; font-weight: 600; }
.lg-muted .lg-m { color: #6b7f9c; }

.bt-local-title { margin: 20px 0 10px; font-size: 13px; font-weight: 700; color: var(--navy); padding-left: 8px; border-left: 4px solid var(--gold); }
.bt-local-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.bt-local-card { background: var(--bg); border: 1px solid var(--line); border-radius: 11px; padding: 14px; }
.bt-lp-name { font-weight: 700; color: var(--navy); font-size: 14.5px; }
.bt-lp-note { font-size: 12px; color: var(--muted); margin: 5px 0 9px; min-height: 30px; }
.bt-lp-state { font-size: 12px; color: var(--muted); margin-bottom: 10px; padding: 5px 8px; background: #fff; border: 1px dashed var(--line); border-radius: 7px; }
.bt-lp-state.ok { color: #1f8a4c; border-style: solid; border-color: #bfe5cd; background: #f2fbf5; }
.bt-lp-state.err { color: #c0392b; border-style: solid; border-color: #f3c8c2; background: #fdf3f2; }
.bt-copy { width: 100%; }
.tag.blue { background: #e8f0fb; color: #1d4e89; }
.empty { color: var(--muted); font-size: 13px; padding: 18px 0; }
.muted { color: var(--muted); font-size: 12.5px; }

/* ========== 监测矩阵覆盖度 ========== */
.cov { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 6px 0 16px; padding: 14px 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; }
.cov-item { min-width: 118px; text-align: center; padding: 4px 10px; border-right: 1px solid var(--line); }
.cov-item:last-of-type { border-right: none; }
.cov-v { font-size: 22px; font-weight: 800; color: var(--navy); line-height: 1.2; }
.cov-k { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.cov-act { margin-left: auto; text-align: right; }
.cov-act .muted { max-width: 260px; }
.cell-na { cursor: pointer; color: #c3cad4; font-size: 17px; }
.cell-na:hover { background: #fff8e6; color: var(--gold); }

/* ========== 双轨对账（人工 vs 第三方） ========== */
.recon-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 0 0 12px; padding: 10px 14px; background: #fbfaf6; border: 1px solid var(--line); border-radius: 10px; }
.recon-bar .muted { font-size: 12px; }
.cell-third { display: inline-block; margin-top: 3px; font-size: 10px; line-height: 1.3; padding: 1px 5px; border-radius: 8px; font-weight: 600; }
.cell-third.ok { color: #2f855a; background: #e6f4ea; }
.cell-third.bad { color: #c53030; background: #fdecec; }
.cell-diverge { outline: 2px solid #e53e3e; outline-offset: -2px; }
.cell-diverge:hover { background: #fdecec; }

/* ========== 矩阵结构化录入弹窗 ========== */
.mx-form-mask { position: fixed; inset: 0; background: rgba(15, 26, 41, .45); display: flex; align-items: center; justify-content: center; z-index: 900; }
.mx-form { width: min(460px, 92vw); background: #fff; border-radius: 14px; padding: 22px 24px; box-shadow: 0 18px 50px rgba(15, 26, 41, .28); }
.mx-form-title { font-size: 17px; font-weight: 800; color: var(--navy); }
.mx-form-sub { font-size: 12.5px; color: var(--muted); margin: 5px 0 16px; line-height: 1.6; }
.mx-form .field { margin-bottom: 12px; }
.mx-form .field label { display: block; font-size: 12px; color: #4a5568; margin-bottom: 4px; font-weight: 600; }
.mx-form .field input, .mx-form .field select { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fdfdfb; }
.mx-form .field input:focus, .mx-form .field select:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.mx-form-act { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ========== 免费档轮转排期 ========== */
.rot-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; margin-top: 10px; }
.rot-now, .rot-next { background: #fbfaf6; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.rot-lab { font-size: 12px; font-weight: 700; color: var(--navy); margin-bottom: 8px; }
.rot-item { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px dashed #e6e2d6; font-size: 13px; }
.rot-item:last-of-type { border-bottom: none; }
.rot-idx { width: 18px; height: 18px; flex: 0 0 18px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.rot-q { flex: 1; color: #2d3748; line-height: 1.5; }
@media (max-width: 720px) { .rot-grid { grid-template-columns: 1fr; } }

/* ========== 发布通道诊断卡 ========== */
.ch-diag { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; margin-top: 8px; }
.ch-card { border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px; padding: 12px 14px; background: var(--bg); }
.ch-ok { border-left-color: #1f8a4c; }
.ch-warn { border-left-color: #d98324; }
.ch-err { border-left-color: #c0392b; }
.ch-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.ch-n { font-size: 14px; font-weight: 700; color: var(--navy); }
.ch-m { font-size: 11px; color: var(--muted); background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 2px 9px; }
.ch-d { font-size: 12.5px; color: #5a6478; line-height: 1.7; margin-top: 7px; }
