/* ============================================================
   新媒体矩阵管理工作台 - 样式
   ============================================================ */
:root {
    --bg: #0f1419;
    --sidebar: #16a34a;
    --card: #1a1f26;
    --line: #2b3138;
    --text: #e6e9ef;
    --muted: #8b949e;
    --green: #16a34a;
    --red: #e0245e;
    --blue: #3b82f6;
    --warn: #f59e0b;
    --info: #4ac6ff;
    --purple: #a06cff;
    --ok: #16a34a;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
}

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    background: var(--sidebar);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
}
.brand { padding: 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.15); }
.brand-logo { font-size: 20px; font-weight: 700; color: #fff; }
.brand-title { font-size: 15px; font-weight: 600; color: #fff; }
.brand-sub { font-size: 11px; color: rgba(255,255,255,.75); }

.nav { padding: 12px 0; flex: 1; }
.nav-item {
    display: block;
    padding: 12px 20px;
    color: rgba(255,255,255,.85);
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
    position: relative;
    transition: background .2s;
}
.nav-item:hover { background: rgba(0,0,0,.12); }
.nav-item.active { background: rgba(0,0,0,.22); color: #fff; font-weight: 600; }
.nav-item .ico { margin-right: 8px; }
.badge {
    background: var(--red);
    color: #fff;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 6px;
}
.sidebar-footer { padding: 14px 20px; border-top: 1px solid rgba(255,255,255,.15); font-size: 11px; color: rgba(255,255,255,.7); }

.main { margin-left: 220px; flex: 1; padding: 24px 28px; }

/* ---------- 页面切换 ---------- */
.tab-page { display: none; }
.tab-page.active { display: block; }

.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.page-header h1 { font-size: 22px; font-weight: 600; }
.header-actions { display: flex; gap: 10px; }

/* ---------- 通用组件 ---------- */
.btn {
    background: var(--card);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: all .2s;
}
.btn:hover { border-color: var(--green); }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
.btn-primary:hover { opacity: .9; }
.btn-sm { padding: 5px 12px; font-size: 12px; }

.input, .select, .textarea {
    background: var(--card);
    border: 1px solid var(--line);
    color: var(--text);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    width: 100%;
}
.input:focus, .select:focus { border-color: var(--green); }
.textarea { min-height: 90px; resize: vertical; font-family: inherit; }
.card .input, .card .select { margin-bottom: 8px; }

/* ---------- 统计卡片 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px;
}
.stat-label { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; }

.section-title { font-size: 16px; font-weight: 600; margin: 24px 0 14px; }

/* ---------- 平台卡片 ---------- */
.platform-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.plat-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 18px;
    border-left: 4px solid;
}
.plat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.plat-name { font-size: 15px; font-weight: 600; }
.plat-tag { font-size: 11px; padding: 2px 8px; border-radius: 4px; background: rgba(255,255,255,.08); color: var(--muted); }
.tag-real { background: rgba(22,163,74,.18); color: #4ade80; border: 1px solid rgba(22,163,74,.35); }
.tag-demo { background: rgba(234,179,8,.14); color: #facc15; border: 1px solid rgba(234,179,8,.3); }
.plat-note { font-size: 11px; line-height: 1.5; color: var(--muted); opacity: .8; margin-bottom: 10px;
    padding: 6px 8px; border-radius: 6px; background: rgba(255,255,255,.04); }
.src-guide { font-size: 12px; line-height: 1.7; color: var(--muted); margin: 8px 0;
    padding: 8px 10px; border-radius: 6px; background: rgba(255,255,255,.04); }
.src-guide b { color: var(--text); font-weight: 500; }
.mi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin: 8px 0; }
.plat-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 13px; border-bottom: 1px dashed rgba(255,255,255,.05); }
.plat-row span:first-child { color: var(--muted); }
.up { color: var(--red); }
.down { color: var(--green); }

/* ---------- 图表 & 表格 ---------- */
.chart-box { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.table-box { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { background: rgba(255,255,255,.03); padding: 11px 14px; text-align: left; color: var(--muted); font-weight: 500; }
.table td { padding: 11px 14px; border-top: 1px solid var(--line); }
.table tr:hover td { background: rgba(255,255,255,.02); }

/* ---------- 评论 ---------- */
.comment-list { display: flex; flex-direction: column; gap: 12px; }
.comment-item {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 16px;
}
.comment-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.comment-author { font-weight: 600; }
.comment-time { color: var(--muted); font-size: 12px; }
.comment-content { margin-bottom: 12px; line-height: 1.6; }
.comment-actions { display: flex; gap: 8px; }

/* ---------- 其他 ---------- */
.settings-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.card h3 { font-size: 15px; margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.empty-state { text-align: center; padding: 60px; color: var(--muted); }
.log-list { max-height: 220px; overflow-y: auto; font-size: 12px; }
.log-item { padding: 6px 0; border-bottom: 1px dashed rgba(255,255,255,.06); }

.status-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.status-ok { color: var(--green); }
.status-no { color: var(--muted); }

.benchmark-list, .news-list { display: flex; flex-direction: column; gap: 12px; }
.bm-item, .news-item { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.bm-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.bm-name { font-weight: 600; font-size: 15px; }
.bm-score { font-size: 13px; color: var(--blue); }

.markdown-box { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 24px; line-height: 1.8; }
.markdown-box h1, .markdown-box h2, .markdown-box h3 { margin: 18px 0 10px; }
.markdown-box li { margin-left: 22px; }

/* ---------- 弹窗 ---------- */
.modal { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 100; align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-box { background: var(--card); border-radius: 12px; width: 560px; max-width: 92vw; border: 1px solid var(--line); }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; }
.close { cursor: pointer; font-size: 22px; color: var(--muted); }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.comment-preview { background: rgba(255,255,255,.03); padding: 12px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.modal-tip { margin-top: 10px; font-size: 12px; color: var(--muted); }

.toast {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(80px);
    background: var(--green); color: #fff; padding: 12px 24px; border-radius: 8px;
    opacity: 0; transition: all .3s; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   运营指标模块（作品动态 / 粉丝增量 / 获客转化 / 内容质量）
   ============================================================ */
.page-header { gap: 12px; }
.page-sub { font-size: 12.5px; color: var(--muted); font-weight: 400; }

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.kpi-row .kpi {
    background: linear-gradient(160deg, #212c42, #1b2437);
    border: 1px solid #2b3854;
    border-radius: 14px;
    padding: 15px 17px;
}
.kpi-row .kpi .label { font-size: 12.5px; color: #6d7c9b; }
.kpi-row .kpi .value { font-size: 25px; font-weight: 700; margin-top: 6px; color: #e8eefb; }
.kpi-row .kpi .value .unit { font-size: 13px; color: #6d7c9b; font-weight: 400; margin-left: 3px; }
.kpi-row .kpi .trend { font-size: 12px; margin-top: 5px; color: #6d7c9b; }

.page-header h1 { color: #e8eefb; }
.page-head p { color: #6d7c9b; }
.page-header .select, .page-header .btn { background: var(--card); }

/* 新模块卡片：统一深色 */
#page-works, #page-fans, #page-acquisition, #page-quality { }
#page-works .card, #page-fans .card, #page-acquisition .card, #page-quality .card {
    background: #1b2437;
    border: 1px solid #2b3854;
}
#page-works .card-title, #page-fans .card-title,
#page-acquisition .card-title, #page-quality .card-title {
    font-size: 14.5px; font-weight: 620; margin-bottom: 14px;
    display: flex; align-items: center; gap: 8px; color: #e8eefb;
}
#page-works .card-title .sub, #page-fans .card-title .sub,
#page-acquisition .card-title .sub, #page-quality .card-title .sub {
    font-size: 12px; color: #6d7c9b; font-weight: 400;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex-shrink: 0; }

/* 图表 */
.chart { width: 100%; height: 300px; }
.chart-sm { height: 250px; }
.chart-lg { height: 400px; }
.chart-xl { height: 520px; }

/* 表格（新版） */
.tbl-wrap { overflow: auto; border-radius: 9px; border: 1px solid #232f47; max-height: 460px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl thead th {
    position: sticky; top: 0; z-index: 2;
    background: #1e2840; color: #93a2c0; font-weight: 600;
    text-align: left; padding: 10px 12px;
    border-bottom: 1px solid #2b3854; white-space: nowrap; font-size: 12.5px;
}
table.tbl tbody td {
    padding: 9px 12px; border-bottom: 1px solid #232f47;
    color: #93a2c0; white-space: nowrap;
}
table.tbl tbody tr:hover td { background: rgba(74,125,255,0.06); color: #e8eefb; }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.tbl td.name { color: #e8eefb; font-weight: 500; }
.tbl-empty { padding: 40px; text-align: center; color: #6d7c9b; font-size: 13px; }

/* 网格工具 */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.mb16 { margin-bottom: 16px; }
.mb12 { margin-bottom: 12px; }
@media (max-width: 1300px) {
    .grid-4, .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
    .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
    .stat-grid, .platform-grid, .settings-grid { grid-template-columns: 1fr; }
}

/* 标签 */
.tag {
    display: inline-block; padding: 2px 9px; border-radius: 20px;
    font-size: 11.5px; background: #212c42; border: 1px solid #2b3854; color: #93a2c0;
}
.tag.ok { background: rgba(46,204,143,0.13); color: var(--green); border-color: rgba(46,204,143,0.3); }
.tag.warn { background: rgba(245,166,35,0.13); color: var(--warn); border-color: rgba(245,166,35,0.3); }
.tag.danger { background: rgba(255,92,122,0.13); color: var(--red); border-color: rgba(255,92,122,0.3); }
.tag.accent { background: rgba(74,125,255,0.14); color: #7ea3ff; border-color: rgba(74,125,255,0.32); }

/* 进度条 */
.bar-head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 5px; }
.bar-head .nm { color: #e8eefb; }
.bar-head .vl { color: #6d7c9b; font-variant-numeric: tabular-nums; }
.bar-track { height: 7px; border-radius: 6px; background: #161d2d; overflow: hidden; border: 1px solid #232f47; }
.bar-fill { height: 100%; border-radius: 6px; transition: width 0.6s ease; }

/* 配对行 */
.pair-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.pair-row .pair-nm { width: 96px; font-size: 12.5px; color: #93a2c0; flex-shrink: 0; }
.pair-row .pair-track { flex: 1; }
.pair-row .pair-val { width: 110px; text-align: right; font-size: 12.5px; color: #e8eefb; flex-shrink: 0; }

/* 洞察卡片 */
.insight {
    background: linear-gradient(160deg, rgba(74,125,255,0.07), transparent);
    border: 1px solid rgba(74,125,255,0.22);
    border-left: 3px solid var(--green);
    border-radius: 9px; padding: 13px 16px;
    font-size: 13px; color: #93a2c0; line-height: 1.75; margin-top: 14px;
}
.insight b { color: #e8eefb; }

/* 结论列表 */
.concl { list-style: none; }
.concl li {
    position: relative; padding: 9px 0 9px 22px;
    border-bottom: 1px dashed #232f47;
    font-size: 13px; color: #93a2c0; line-height: 1.7;
}
.concl li:last-child { border-bottom: none; }
.concl li::before {
    content: ""; position: absolute; left: 5px; top: 16px;
    width: 6px; height: 6px; border-radius: 50%; background: var(--green);
}
.concl li b { color: #e8eefb; }

/* ===== 作品详情抽屉 ===== */
.drawer-mask {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.55); z-index: 90;
}
.drawer-mask.show { display: block; }
.drawer {
    position: fixed; top: 0; right: 0; bottom: 0;
    width: 760px; max-width: 95vw;
    background: var(--bg); border-left: 1px solid var(--line);
    z-index: 95; transform: translateX(100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    display: flex; flex-direction: column;
    box-shadow: -12px 0 40px rgba(0,0,0,.35);
}
.drawer.show { transform: translateX(0); }
.drawer-header {
    padding: 18px 22px; border-bottom: 1px solid var(--line);
    display: flex; align-items: flex-start; gap: 14px; flex-shrink: 0;
}
.drawer-title { font-size: 16.5px; font-weight: 600; color: #e8eefb; line-height: 1.5; word-break: break-all; }
.drawer-meta { margin-top: 8px; font-size: 12.5px; color: #6d7c9b; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 22px 40px; }
.drawer-body::-webkit-scrollbar { width: 8px; }
.drawer-body::-webkit-scrollbar-thumb { background: #2b3854; border-radius: 4px; }

.pd-sec { margin-bottom: 22px; }
.pd-sec-t {
    font-size: 13.5px; font-weight: 600; color: #e8eefb;
    margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.pd-sec-t::before { content: ""; width: 3px; height: 13px; background: var(--green); border-radius: 2px; }

.pd-metrics { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 10px; }
.pd-metric {
    background: var(--card); border: 1px solid var(--line);
    border-radius: 9px; padding: 12px 10px; text-align: center;
}
.pd-metric .m-label { font-size: 11.5px; color: #6d7c9b; }
.pd-metric .m-val { font-size: 20px; font-weight: 700; color: #e8eefb; margin: 6px 0 3px; font-variant-numeric: tabular-nums; }
.pd-metric .m-sub { font-size: 11px; }
.pd-metric .m-sub.up { color: var(--green); }
.pd-metric .m-sub.down { color: var(--red); }

.pd-advice { list-style: none; }
.pd-advice li {
    display: flex; gap: 10px; align-items: flex-start;
    padding: 11px 13px; border-radius: 8px; margin-bottom: 8px;
    font-size: 12.8px; line-height: 1.7; color: #a9b6ce;
    background: #161d2d; border-left: 3px solid #3b4a68;
}
.pd-advice li.ok { border-left-color: var(--green); }
.pd-advice li.warn { border-left-color: var(--warn); }
.pd-advice li.tip { border-left-color: var(--accent, #4a7dff); }
.pd-advice li .ic { flex-shrink: 0; font-size: 13px; }

.pd-cmt {
    border: 1px solid var(--line); border-radius: 9px;
    padding: 12px 14px; margin-bottom: 9px; background: var(--card);
}
.pd-cmt .top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; }
.pd-cmt .nm { font-size: 12.8px; color: #e8eefb; font-weight: 500; }
.pd-cmt .tm { font-size: 11.5px; color: #6d7c9b; margin-left: auto; }
.pd-cmt .ct { font-size: 13px; color: #a9b6ce; line-height: 1.65; }
.pd-cmt .rp {
    margin-top: 9px; padding: 9px 11px; border-radius: 7px;
    background: rgba(46,204,143,0.08); border: 1px solid rgba(46,204,143,0.22);
    font-size: 12.5px; color: #93a2c0; line-height: 1.6;
}
.pd-cmt .act { margin-top: 9px; display: flex; gap: 8px; }

/* 可点击的作品标题 */
.link-title {
    cursor: pointer; color: #e8eefb; text-decoration: none;
    border-bottom: 1px dashed transparent; transition: color .15s, border-color .15s;
}
.link-title:hover { color: #7ea3ff; border-bottom-color: #7ea3ff; }

@media (max-width: 900px) {
    .pd-metrics { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
