/* ===== 官网管理后台（/manage）===== */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --brand: #b0312a;
  --brand-dark: #8e2620;
  --ink: #1f2733;
  --muted: #5b6775;
  --bg: #f4f6f9;
  --bg-soft: #eef1f5;
  --line: #e4e8ee;
  --panel: #ffffff;
  --green: #0b7a4b;
  --green-bg: #e7f5ee;
  --amber: #9a6700;
  --amber-bg: #fdf3dc;
  --red: #c0392b;
  --red-bg: #fdecea;
  --radius: 12px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--red); font-size: 13px; min-height: 18px; }

/* 登录 */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 36px 32px; width: 100%; max-width: 380px; box-shadow: 0 8px 30px rgba(20,40,80,.06);
  display: flex; flex-direction: column; gap: 14px;
}
.login-logo { font-size: 40px; text-align: center; }
.login-card h1 { text-align: center; font-size: 20px; }
.login-sub { text-align: center; color: var(--muted); font-size: 13px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.login-hint { font-size: 12px; color: var(--muted); text-align: center; }

/* 顶栏 */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  background: #fff; border-bottom: 1px solid var(--line);
  padding: 10px 22px; position: sticky; top: 0; z-index: 20;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 10px; }
.logo { font-size: 20px; }

/* 标签页 */
.tabs {
  display: flex; gap: 2px; padding: 0 22px; background: #fff;
  border-bottom: 1px solid var(--line); position: sticky; top: 53px; z-index: 10;
}
.tab {
  appearance: none; border: 0; background: transparent; padding: 12px 16px;
  cursor: pointer; font-size: 14px; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 600; }
.tabpane { display: none; }
.tabpane.active { display: block; }

/* 内容区 */
.content { max-width: 1080px; margin: 22px auto 60px; padding: 0 22px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar-left, .toolbar-right { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel.stack { display: flex; flex-direction: column; gap: 10px; }
.panel h3 { font-size: 15px; margin-bottom: 4px; }

/* 表单 */
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.input, select.input {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px;
  font-size: 14px; color: var(--ink); background: #fff; width: 100%; font-family: inherit;
}
.input:focus, select.input:focus { outline: 2px solid rgba(176,49,42,.25); border-color: var(--brand); }
.input-sm { padding: 6px 8px; font-size: 13px; width: auto; }
.input-color { width: 56px; height: 38px; padding: 3px; }
.codebox { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.form-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.form-actions { display: flex; gap: 12px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--muted); }
.hint code { background: var(--bg-soft); padding: 1px 5px; border-radius: 4px; }

/* 按钮 */
.btn {
  appearance: none; border: 1px solid transparent; border-radius: 8px;
  padding: 8px 16px; font-size: 14px; cursor: pointer; font-family: inherit;
  background: var(--bg-soft); color: var(--ink); transition: opacity .15s;
}
.btn:hover { opacity: .88; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; border-color: var(--line); }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; padding: 11px; }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: #f3cfc9; }

/* 表格 */
.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.grid th { color: var(--muted); font-weight: 500; font-size: 12.5px; background: var(--bg-soft); }
.grid th:first-child { border-radius: 8px 0 0 8px; }
.grid th:last-child { border-radius: 0 8px 8px 0; }
.grid tr:hover td { background: #fafbfc; }
.col-ops { width: 280px; }
.ops { display: flex; gap: 6px; }
.ops .btn { padding: 3px 9px; font-size: 12px; }
.empty { color: var(--muted); text-align: center; padding: 26px 0; }
.pager { display: flex; justify-content: center; gap: 6px; padding-top: 12px; }
.pager button { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 4px 11px; cursor: pointer; }
.pager button.cur { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager button:disabled { opacity: .4; }

/* 徽标 */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: var(--bg-soft); color: var(--muted); }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-red { background: var(--red-bg); color: var(--red); }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.sd-published { background: var(--green); }
.sd-draft { background: #98a2b3; }
.sd-other { background: var(--amber); }

/* 公众号卡片 */
.card-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.wx-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; flex-wrap: wrap; }
.wx-card .meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.wx-card .actions { display: flex; gap: 6px; }

/* 域名盒 */
.domain-box { border: 1px dashed var(--line); border-radius: 12px; padding: 16px; background: #fafbfc; display: flex; flex-direction: column; gap: 10px; }
.domain-main { display: flex; align-items: center; gap: 12px; }
.domain-url { font-size: 17px; font-weight: 600; color: var(--brand); word-break: break-all; }

/* 抽屉 */
.mask { position: fixed; inset: 0; background: rgba(15,23,42,.42); z-index: 40; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 96vw);
  background: #fff; z-index: 41; display: flex; flex-direction: column;
  box-shadow: -12px 0 40px rgba(15,23,42,.16);
}
.drawer-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
}
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }

/* 弹窗（导航项编辑 / 媒体选择器）
   z-index 必须高于抽屉(41)：文章编辑器里的「从媒体库选择」要在抽屉之上弹出 */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 50; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-card {
  background: #fff; border-radius: 14px; width: min(920px, 96vw); max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: 0 18px 50px rgba(15,23,42,.24); overflow: hidden;
}
.modal-sm { width: min(560px, 96vw); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 15px; }
.modal-body { padding: 16px 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }

/* 媒体网格 */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.media-item { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; display: flex; flex-direction: column; }
.media-thumb { height: 116px; background: var(--bg-soft); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-meta { padding: 8px 10px 4px; display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; }
.media-name { font-size: 12.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-ops { display: flex; gap: 6px; padding: 0 10px 10px; margin-top: auto; }
.media-ops .btn { padding: 3px 9px; font-size: 12px; flex: 1; }

/* 主题预设 */
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; align-items: start; }
.preset-chip {
  appearance: none; cursor: pointer; font-family: inherit; text-align: left;
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--ink);
}
.preset-chip:hover { border-color: var(--brand); }
.preset-chip.active { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(176,49,42,.18); background: #fffafa; }
.preset-chip b { font-weight: 600; }
.preset-tag { font-size: 10.5px; font-weight: 400; color: var(--brand); background: #fdecea; border-radius: 999px; padding: 0 6px; margin-left: 6px; vertical-align: 1px; }
.preset-dots { display: flex; gap: 4px; }
.preset-dots i { width: 14px; height: 14px; border-radius: 4px; border: 1px solid rgba(15,23,42,.12); display: inline-block; }
.preset-desc { font-size: 11.5px; color: var(--muted); }
.preset-chip-custom { cursor: default; color: var(--muted); justify-content: center; }
.preset-note { grid-column: 1 / -1; font-size: 12px; color: var(--amber); background: var(--amber-bg); border-radius: 8px; padding: 6px 10px; }

/* 细调颜色 */
.token-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fafbfc; }
.token-row label { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; color: var(--ink); }
.token-input { display: flex; align-items: center; gap: 6px; }
.token-color { width: 38px; height: 32px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: #fff; cursor: pointer; }
.token-color:disabled { opacity: .45; cursor: not-allowed; }
.token-hex { width: 106px; }
.token-badge { font-size: 11px; padding: 1px 8px; border-radius: 999px; background: var(--bg-soft); color: var(--muted); }
.token-badge.on { background: var(--green-bg); color: var(--green); }
.token-badge.off { background: var(--amber-bg); color: var(--amber); }
.token-row .hint { margin-left: auto; }

/* 导航表 */
.col-sort { width: 96px; }
.sort-ops { display: flex; gap: 4px; }
.btn-mini { padding: 1px 8px; font-size: 12px; line-height: 1.5; background: #fff; border-color: var(--line); }
.chk-inline { width: 16px; height: 16px; cursor: pointer; }
.chk { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
.chk input { width: 16px; height: 16px; }
.nav-url { font-size: 12.5px; background: var(--bg-soft); padding: 1px 6px; border-radius: 4px; word-break: break-all; }
.nav-indent { color: var(--muted); margin-right: 2px; }
.nav-child-row td { background: #fcfcfd; }
.nav-child-row:hover td { background: #fafbfc; }
.pill-mini { font-size: 11px; padding: 1px 7px; }

/* 「从媒体库选择」按钮（内嵌在 label 里，不占满整行） */
.pick-btn { align-self: flex-start; margin-top: 2px; }

/* 提示条 */
.toast {
  position: fixed; left: 50%; bottom: 30px; transform: translateX(-50%);
  background: #1f2733; color: #fff; padding: 10px 20px; border-radius: 10px;
  font-size: 13.5px; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,.2); max-width: 80vw;
}
.toast.ok { background: #0b7a4b; }
.toast.bad { background: #c0392b; }

@media (max-width: 640px) {
  .topbar { padding: 10px 14px; }
  .tabs { padding: 0 6px; }
  .content { padding: 0 12px; }
  .tab { padding: 10px 10px; font-size: 13px; }
  .media-grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
  .token-row .hint { margin-left: 0; }
}

/* ---------- Hero 轮播页签 ---------- */
.hero-list { display: flex; flex-direction: column; gap: 14px; }
.hero-row { display: flex; gap: 14px; padding: 14px; border: 1px solid var(--line, #e3e8ef);
  border-radius: 10px; background: var(--bg-soft, #f8fafc); }
.hero-thumb { flex: 0 0 132px; width: 132px; height: 74px; border-radius: 8px; overflow: hidden;
  background: #0c2240; display: flex; align-items: center; justify-content: center; }
.hero-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.hero-thumb-ph { color: #93a3b8; font-size: 12px; }
.hero-fields { flex: 1 1 auto; min-width: 0; }
.hero-row-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.hero-idx { font-size: 12px; font-weight: 600; color: var(--muted, #64748b); }
.hero-ops { display: flex; gap: 6px; }
.icon-btn { border: 1px solid var(--line, #e3e8ef); background: #fff; border-radius: 6px;
  padding: 2px 8px; font-size: 12px; cursor: pointer; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn-bad { color: #b42318; border-color: #f4c7c3; }
.hero-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.hero-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px;
  color: var(--muted, #64748b); }
.hero-col-full { grid-column: 1 / -1; }
.hero-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero-url { font-size: 11px; color: var(--muted, #64748b); word-break: break-all; }
@media (max-width: 720px) {
  .hero-row { flex-direction: column; }
  .hero-thumb { flex: none; width: 100%; height: 132px; }
  .hero-grid { grid-template-columns: 1fr; }
}

/* ===== 首页内容块可视化编辑器 ===== */
#hb-editor { display: block; }
.hb-card { border: 1px solid var(--border, #d6e4e8); border-radius: 10px; padding: 12px 14px; margin: 12px 0; background: var(--bg-surface, #fff); }
.hb-card.hb-off { opacity: .72; background: #fafcfd; }
.hb-card-h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.hb-card-h b { font-size: 15px; }
.hb-pill { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: #0091b2; color: #fff; }
.hb-card.hb-off .hb-pill { background: #8a96a3; }
.hb-card-h .btn { margin-left: auto; }
.hb-card-h .btn + .btn { margin-left: 6px; }
.hb-row { margin: 6px 0; }
.hb-row label { display: block; font-size: 13px; color: #5b6775; margin-bottom: 3px; }
.hb-row input, .hb-row textarea { width: 100%; }
.hb-cover { display: flex; gap: 10px; align-items: flex-start; }
.hb-thumb { width: 96px; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid #d6e4e8; }
.hb-feats { display: block; }
.hb-feat { border: 1px dashed #cfe0e6; border-radius: 8px; padding: 8px 10px; margin: 8px 0; }
.hb-feat-h { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.hb-feat-btns { margin-left: auto; }
.hb-badges .hb-badge, .hb-points .hb-row { display: flex; gap: 6px; align-items: center; margin: 4px 0; }
.hb-badge input, .hb-points input { flex: 1; }
.hb-other-json { background: #f3f6f8; border-radius: 6px; padding: 8px; font-size: 12px; max-height: 160px; overflow: auto; }
.hb-adv { margin: 10px 0; border: 1px solid #e3edf0; border-radius: 8px; padding: 8px 12px; }
.hb-adv summary { cursor: pointer; font-size: 13px; color: #5b6775; }

/* ===== 正文双模式编辑器（所见即所得 / HTML 源码）— 2026-10-06 =====
   保真说明：所见即所得用原生 contenteditable（不做 schema 归一），
   实测打开→保存的 round-trip 结构零损失（详见 docs/audit）。 */
.ed-body-label { display: block; font-weight: 600; margin: 14px 0 6px; }
.ed-modebar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.ed-modes { display: inline-flex; border: 1px solid #d9dee6; border-radius: 8px; overflow: hidden; }
.ed-mode { border: 0; background: transparent; padding: 6px 14px; font-size: 13px; cursor: pointer; color: #5b6572; }
.ed-mode.is-on { background: #eef3fb; color: #1f4e9c; font-weight: 600; }
.ed-fidelity { font-size: 12px; color: #8a94a3; }
.ed-fidelity.has-style { color: #8a6d1f; }
.ed-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px; border: 1px solid #d9dee6; border-bottom: 0; border-radius: 8px 8px 0 0; background: #f7f9fc; }
.ed-tb { border: 1px solid transparent; background: transparent; border-radius: 6px; min-width: 30px; height: 28px; padding: 0 8px; font-size: 13px; cursor: pointer; color: #334; }
.ed-tb:hover { background: #e8eef8; border-color: #cfdcef; }
.ed-sep { width: 1px; height: 18px; background: #dde3ec; margin: 0 3px; }
.ed-rich { min-height: 320px; max-height: 58vh; overflow: auto; padding: 14px 16px; border: 1px solid #d9dee6; border-radius: 0 0 8px 8px; background: #fff; line-height: 1.75; }
.ed-rich:focus { outline: 2px solid #cfe0f7; outline-offset: -1px; }
.ed-rich img { max-width: 100%; height: auto; }
.ed-rich:empty::before { content: '在此直接编辑正文（所见即所得）…'; color: #aab3c0; }
