/* ==========================================================================
   软文发稿系统 · 通用样式
   ========================================================================== */
:root {
    --primary: #2f9e44;
    --primary-2: #37b24d;
    --primary-dark: #237a34;
    --dark: #1f2d3d;
    --dark-2: #18232f;
    --line: #e6eaee;
    --text: #2b2f33;
    --muted: #7b8794;
    --bg: #f4f6f8;
    --blue: #1c7ed6;
    --orange: #f08c00;
    --purple: #7048e8;
    --red: #e03131;
    --gray: #868e96;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* ---------------- 布局 ---------------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 216px; flex: 0 0 216px; background: var(--dark); color: #c8d2dc; display: flex; flex-direction: column; }
.sidebar .brand {
    height: 58px; display: flex; align-items: center; gap: 8px; padding: 0 18px;
    background: var(--dark-2); color: #fff; font-weight: 600; font-size: 15px;
}
.sidebar .brand .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--primary-2); }
.sidebar .menu { padding: 8px 0 20px; flex: 1; overflow: auto; }
.sidebar .menu .group { padding: 12px 18px 6px; font-size: 12px; color: #5f6f80; }
.sidebar .menu a { display: block; padding: 10px 18px 10px 20px; color: #a9b7c6; border-left: 3px solid transparent; font-size: 14px; }
.sidebar .menu a:hover { background: #26374a; color: #fff; }
.sidebar .menu a.active { background: #26374a; color: #fff; border-left-color: var(--primary-2); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    height: 58px; background: #fff; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; justify-content: space-between; padding: 0 20px;
    position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 600; }
.topbar .user { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 14px; }
.topbar .user a:hover { color: var(--primary); }
.content { padding: 20px; flex: 1; }

/* ---------------- 卡片 ---------------- */
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(15, 30, 50, .06); padding: 18px 20px; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 600; margin: 0 0 14px; display: flex; align-items: center; justify-content: space-between; }
.card-title small { font-weight: 400; color: var(--muted); font-size: 12px; }

/* ---------------- 统计卡 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: 8px; padding: 16px 18px; box-shadow: 0 1px 3px rgba(15, 30, 50, .06); }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 24px; font-weight: 600; margin-top: 6px; }
.stat .value.green { color: var(--primary); }
.stat .value.blue { color: var(--blue); }
.stat .value.orange { color: var(--orange); }
.stat .value.purple { color: var(--purple); }
.stat .value.red { color: var(--red); }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eef1f4; font-size: 13px; vertical-align: middle; }
th { background: #fafbfc; color: #5b6b7c; font-weight: 600; white-space: nowrap; }
tbody tr:hover { background: #fafcff; }
td .op { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 34px 0; }

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-block; padding: 7px 14px; border-radius: 5px; border: 1px solid transparent;
    background: #eef1f4; color: #37424e; cursor: pointer; font-size: 13px; line-height: 1.4; font-family: inherit;
}
.btn:hover { opacity: .9; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-plain { background: #fff; border-color: #d5dbe1; color: #37424e; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { display: block; width: 100%; text-align: center; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------------- 徽标 ---------------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 12px; line-height: 1.6; white-space: nowrap; }
.badge-green { background: #e6f7ec; color: #2b8a3e; }
.badge-blue { background: #e7f1fb; color: #1864ab; }
.badge-orange { background: #fff4e6; color: #b35c00; }
.badge-purple { background: #f0eafe; color: #5f3dc4; }
.badge-red { background: #fdecec; color: #c92a2a; }
.badge-gray { background: #eef1f4; color: #616e7c; }

/* ---------------- 表单 ---------------- */
.form-item { margin-bottom: 16px; }
.form-item > label { display: block; margin-bottom: 6px; font-size: 13px; color: #44515e; font-weight: 600; }
.form-item .tip { color: var(--muted); font-size: 12px; margin-top: 5px; }
.input { width: 100%; padding: 9px 11px; border: 1px solid #d5dbe1; border-radius: 5px; font-size: 13px; font-family: inherit; background: #fff; color: var(--text); }
textarea.input { min-height: 130px; resize: vertical; }
select.input { appearance: auto; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(47, 158, 68, .12); }
.form-row { display: flex; gap: 16px; }
.form-row .form-item { flex: 1; }
.form-inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.form-inline .form-item { margin-bottom: 0; }
.radio-line { display: flex; gap: 18px; align-items: center; font-size: 13px; }
.radio-line label { font-weight: 400; color: var(--text); display: inline-flex; align-items: center; gap: 5px; }

/* ---------------- 登录 ---------------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1f2d3d 0%, #2f9e44 100%); padding: 20px; }
.login-box { width: 390px; max-width: 100%; background: #fff; border-radius: 10px; padding: 32px 30px; box-shadow: 0 18px 50px rgba(0, 0, 0, .25); }
.login-box h2 { margin: 0 0 6px; font-size: 20px; }
.login-box .sub { color: var(--muted); font-size: 13px; margin-bottom: 22px; }
.login-box .btn { width: 100%; padding: 11px; font-size: 15px; margin-top: 8px; }
.alert { padding: 9px 12px; border-radius: 5px; font-size: 13px; margin-bottom: 14px; }
.alert-error { background: #fdecec; color: #c92a2a; }
.alert-info { background: #e7f1fb; color: #1864ab; }
.alert-success { background: #e6f7ec; color: #2b8a3e; }

/* ---------------- 门户 ---------------- */
.site-header { background: #fff; border-bottom: 1px solid var(--line); }
.site-header .inner { display: flex; align-items: center; justify-content: space-between; height: 66px; }
.site-header .logo { font-size: 18px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.site-header .nav a { margin-left: 20px; color: #44515e; font-size: 14px; }
.site-header .nav a:hover { color: var(--primary); }
.hero { padding: 70px 0 86px; text-align: center; background: linear-gradient(135deg, #1f2d3d 0%, #2f9e44 100%); color: #fff; }
.hero h1 { font-size: 32px; margin: 0 0 14px; }
.hero p { opacity: .92; margin: 0 auto 26px; max-width: 620px; }
.hero .btn { padding: 11px 26px; font-size: 15px; background: #fff; color: var(--primary-dark); font-weight: 600; }
.entry-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: -46px; }
.entry-card { background: #fff; border-radius: 8px; padding: 22px; box-shadow: 0 4px 16px rgba(15, 30, 50, .08); text-align: center; }
.entry-card h3 { margin: 0 0 8px; font-size: 16px; }
.entry-card p { color: var(--muted); font-size: 13px; min-height: 40px; margin: 0 0 14px; }
.section { padding: 46px 0; }
.section h2 { text-align: center; font-size: 22px; margin: 0 0 26px; }
.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.flow .step { background: #fff; border-radius: 8px; padding: 18px; box-shadow: 0 1px 3px rgba(15, 30, 50, .06); }
.flow .step b { display: block; color: var(--primary); margin-bottom: 6px; }
.flow .step span { color: var(--muted); font-size: 13px; }
.site-footer { padding: 26px 0; text-align: center; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); background: #fff; }

/* ---------------- 详情 ---------------- */
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 16px 18px; border-left: 2px solid #e6eaee; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); }
.timeline .t { color: var(--muted); font-size: 12px; }
.media-card { border: 1px solid var(--line); border-radius: 8px; padding: 16px; background: #fff; display: flex; flex-direction: column; }
.media-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.media-card .name { font-weight: 600; font-size: 15px; }
.media-card .price { color: var(--red); font-weight: 600; font-size: 18px; }
.media-card .meta { color: var(--muted); font-size: 12px; margin: 8px 0 12px; }

/* ---------------- 代码块 ---------------- */
.code-box { background: #0f1a24; color: #c8e6d0; padding: 14px 16px; border-radius: 6px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; overflow-x: auto; white-space: pre; line-height: 1.7; }

/* ---------------- 工具类 ---------------- */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.muted { color: var(--muted); }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }
.danger-text { color: var(--red); }
.success-text { color: var(--primary); }

/* ---------------- 提示条 ---------------- */
#sa-toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
#sa-toast .item { background: rgba(31, 45, 61, .95); color: #fff; padding: 10px 18px; border-radius: 6px; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }

@media (max-width: 900px) {
    .stat-grid, .flow, .entry-grid { grid-template-columns: repeat(2, 1fr); }
    .media-grid { grid-template-columns: repeat(2, 1fr); }
    .sidebar { width: 60px; flex: 0 0 60px; }
    .sidebar .brand span.t, .sidebar .menu span.t { display: none; }
}

/* ---------------- 补充：统计卡提示 / 键值对 / 分页 ---------------- */
.stat .tip { color: var(--muted); font-size: 12px; margin-top: 6px; }
.kv { line-height: 1.9; }
.kv .v { color: #1f2d3d; }
.kv-4 { grid-template-columns: 110px 1fr 110px 1fr; }
.pager { display: flex; gap: 6px; align-items: center; padding: 14px 0 4px; font-size: 13px; flex-wrap: wrap; }
.pager a, .pager span { display: inline-block; padding: 4px 10px; border: 1px solid var(--line); border-radius: 4px; color: #33507a; }
.pager a:hover { background: #f2f6fa; }
.pager .on { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager .muted { color: var(--muted); }
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter-bar .sp { flex: 1; }

/* 支付渠道选择 */
.pay-channel { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.pay-item { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 9px 16px; cursor: pointer; font-size: 14px; }
.pay-item:hover { border-color: var(--primary); }
.pay-item input { margin: 0; }
.pay-name { font-weight: 500; }

/* 权限勾选 */
.perm-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 6px; }
.perm-item { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 6px; padding: 9px 12px; font-size: 13px; cursor: pointer; }
.perm-item:hover { border-color: var(--primary); }
.perm-item input { margin: 0; }

/* ==========================================================================
   用户端 · 折叠导航
   ========================================================================== */
.menu .menu-link { display:block; padding:10px 16px; color:#c9d3e0; border-radius:8px; margin:2px 6px; }
.menu .menu-link:hover { background:rgba(255,255,255,.08); color:#fff; }
.menu .menu-link.active { background:#2f6feb; color:#fff; }
.menu-group { margin:2px 6px; }
.menu-group > .g-title { display:flex; justify-content:space-between; align-items:center; padding:10px 12px; color:#c9d3e0; cursor:pointer; border-radius:8px; }
.menu-group > .g-title:hover { background:rgba(255,255,255,.08); color:#fff; }
.menu-group .arrow { transition:transform .2s; font-size:12px; opacity:.7; }
.menu-group.open > .g-title .arrow { transform:rotate(180deg); }
.menu-group .sub { display:none; padding:2px 0 6px 8px; }
.menu-group.open .sub { display:block; }
.menu-group .sub a { display:block; padding:8px 14px; color:#aebbc9; border-radius:8px; font-size:13px; }
.menu-group .sub a:hover { background:rgba(255,255,255,.06); color:#fff; }
.menu-group .sub a.active { background:rgba(47,111,235,.22); color:#fff; }
.menu-group.open > .g-title { color:#fff; }

/* ==========================================================================
   发布页（稿件上传 + 编辑器 + 选媒体）
   ========================================================================== */
.publish-grid { display:grid; grid-template-columns:420px 1fr; gap:16px; align-items:start; }
@media (max-width:1200px) { .publish-grid { grid-template-columns:1fr; } }
.upload-box { border:1px dashed #b9c4d2; border-radius:8px; padding:14px; text-align:center; color:#5b6b7c; background:#fafcff; }
.upload-box .big { font-size:26px; color:#2f6feb; line-height:1.4; }
.upload-box .hint { font-size:12px; color:#8a97a6; margin-top:4px; }
.radio-line.inline label { margin-right:14px; }
.toolbar-row { display:flex; flex-wrap:wrap; gap:8px; margin:6px 0; }
.toolbar-row .btn { padding:6px 10px; }
.editor-wrap { border:1px solid #dbe2ea; border-radius:8px; overflow:hidden; }
.editor-toolbar { display:flex; flex-wrap:wrap; gap:4px; padding:6px 8px; background:#f5f7fa; border-bottom:1px solid #e3e8ee; }
.editor-toolbar .tb { min-width:28px; height:26px; padding:0 8px; border:1px solid #d3dbe4; background:#fff; border-radius:4px; cursor:pointer; font-size:13px; line-height:24px; }
.editor-toolbar .tb:hover { border-color:#2f6feb; color:#2f6feb; }
.editor-toolbar select { height:26px; border:1px solid #d3dbe4; border-radius:4px; background:#fff; }
.editor-body { min-height:320px; padding:14px 16px; outline:none; line-height:1.8; color:#1f2933; overflow-y:auto; max-height:560px; }
.editor-body:empty:before { content:attr(data-placeholder); color:#9aa7b4; }
.editor-foot { display:flex; justify-content:space-between; font-size:12px; color:#8a97a6; padding:4px 8px; border-top:1px solid #eef2f6; background:#fafcff; }
.media-pick-bar { display:flex; flex-wrap:wrap; gap:8px; align-items:center; margin-bottom:10px; }
.media-pick-bar .spacer { flex:1; }
.media-table td, .media-table th { font-size:13px; }
.media-table .fav-on { color:#e8a33d; }
.fav-folder-bar { display:flex; gap:6px; flex-wrap:wrap; margin:6px 0 12px; }
.fav-folder-bar .fb { padding:4px 12px; border:1px solid #d3dbe4; border-radius:14px; cursor:pointer; font-size:12px; background:#fff; }
.fav-folder-bar .fb.on { background:#2f6feb; color:#fff; border-color:#2f6feb; }
.notice-box { background:#fff8e6; border:1px solid #ffe2a8; border-radius:8px; padding:12px 16px; font-size:13px; color:#8a6d1f; line-height:1.9; }
.notice-box ol { margin:0; padding-left:20px; }
.notice-box .nt { font-weight:600; margin-bottom:4px; }
.publish-side { position:sticky; top:16px; }
.price-tag { color:#e03131; font-weight:600; }
.thumb-cell { width:46px; height:46px; display:flex; align-items:center; justify-content:center; background:#eef3fb; border-radius:6px; color:#2f6feb; font-size:18px; }
.entry-grid.small .entry-card { padding:14px; }

/* 多标题列表 */
.multi-title-list { background:#fafcff; border:1px solid #e3e8ee; border-radius:8px; padding:10px 12px; }
.multi-title-list .form-inline { display:flex; align-items:center; gap:10px; }

/* ==========================================================================
   订单 / 详情 / 列表通用
   ========================================================================== */
.detail-grid { display:grid; grid-template-columns:1fr 320px; gap:16px; align-items:start; }
@media (max-width:1100px) { .detail-grid { grid-template-columns:1fr; } }
.kv-table { width:100%; border-collapse:collapse; }
.kv-table th { width:110px; text-align:left; background:#f8fafc; color:#54606e; font-weight:600; }
.kv-table th, .kv-table td { border:1px solid #e6eaee; padding:9px 12px; font-size:13px; }
.article-preview { border:1px solid #e6eaee; border-radius:8px; padding:14px 16px; line-height:1.85; max-height:420px; overflow:auto; }
.article-preview img { max-width:100%; }
.op-stack { display:flex; flex-direction:column; gap:8px; }
.op-stack form { margin:0; }
.btn-block { display:block; width:100%; text-align:center; }
.tl-time { color:#8a97a6; font-size:12px; }
.tl-body { color:#1f2933; font-size:13px; }
.tab-bar { display:flex; flex-wrap:wrap; gap:4px; border-bottom:1px solid #e6eaee; margin-bottom:12px; }
.tab-bar a { padding:8px 14px; font-size:13px; color:#54606e; border-bottom:2px solid transparent; }
.tab-bar a:hover { color:var(--primary); }
.tab-bar a.on { color:var(--primary); border-bottom-color:var(--primary); font-weight:600; }
.pager-row { display:flex; align-items:center; gap:10px; justify-content:flex-end; margin-top:12px; }
