/* ============================================================
   手机CMS 后台样式（独立自包含，不依赖前台主题）
   传统系统后台：左侧 220px 一级菜单 + 右侧内容区
   ============================================================ */

:root {
  --primary: #2f6fed;
  --primary-d: #1e56cf;
  --primary-bg: #eaf1ff;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1d2129;
  --text2: #6b7280;
  --text3: #9aa1ad;
  --line: #eceef2;
  --danger: #e5484d;
  --sidebar-bg: #1f2733;
  --sidebar-bg2: #28323f;
  --sidebar-text: #aeb8c6;
  --sidebar-active: #2f6fed;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
code { font-family: Consolas, Monaco, "Courier New", monospace; }

/* ============================================================
   整体布局：左菜单 + 右内容
   ============================================================ */
.admin-layout { display: flex; min-height: 100vh; }

/* ---------- 左侧边栏 ---------- */
.admin-sidebar {
  width: 220px;
  flex: none;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  height: 62px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sb-logo {
  width: 34px; height: 34px; flex: none;
  border-radius: 9px;
  background: linear-gradient(135deg,#4f8cff,#2f6fed);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
}
.sb-logo svg { width: 20px; height: 20px; }
.sb-name {
  color: #fff; font-size: 15px; font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.menu-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-size: 14px;
  transition: background .15s, color .15s;
}
.menu-item svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.menu-item:hover { background: var(--sidebar-bg2); color: #fff; }
.menu-item.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.menu-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sb-copyright {
  display: block;
  text-align: center;
  font-size: 12px;
  color: #7a8494;
  padding: 6px 0;
  transition: color .15s;
}
.sb-copyright:hover { color: #aeb8c6; }

/* ---------- 右侧主区域 ---------- */
.admin-main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
  height: 62px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px;
  position: sticky; top: 0; z-index: 30;
}
.topbar-title { font-size: 18px; font-weight: 700; margin: 0; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-user {
  font-size: 13px;
  color: var(--text2);
  margin-right: 4px;
}
.topbar-link {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text2);
  font-size: 13px;
  transition: all .15s;
}
.topbar-link:hover { border-color: var(--primary); color: var(--primary); }
.topbar-link svg { width: 16px; height: 16px; }
.topbar-logout:hover { border-color: var(--danger); color: var(--danger); background: #fef2f2; }

.admin-content { padding: 22px 24px 40px; flex: 1; min-width: 0; }

/* 右侧页面底部版权 */
.admin-footer {
  margin-top: auto;
  padding: 18px 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text3);
  border-top: 1px solid var(--line);
  background: var(--card);
}
.admin-footer a { color: var(--text2); }
.admin-footer a:hover { color: var(--primary); text-decoration: underline; }

/* 提示条 */
.flash {
  margin: 14px 24px 0;
  max-width: 1100px;
  padding: 11px 16px;
  background: #eef7ee;
  color: #2e7d32;
  border: 1px solid #cfe8d0;
  border-radius: 10px;
  font-size: 13px;
}

/* ============================================================
   通用组件
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  height: 42px; padding: 0 18px;
  border-radius: 10px; border: none;
  font-size: 14px; font-weight: 600;
  color: #fff; background: var(--primary);
  transition: opacity .15s, background .15s;
}
.btn:hover { opacity: .92; }
.btn:active { opacity: .85; }
.btn-block { display: flex; width: 100%; }
.btn-outline { background: var(--card); color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-bg); opacity: 1; }
.btn-ghost { background: #f0f2f7; color: var(--text2); }
.btn-ghost:hover { background: #e4e8f0; opacity: 1; }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13px; border-radius: 8px; }
.btn-danger { background: var(--danger); }
.btn svg { width: 18px; height: 18px; }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: none; background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text);
}
.icon-btn:hover { background: #eef1f6; }
.icon-btn svg { width: 22px; height: 22px; }

.form-group { margin-bottom: 12px; }
.form-row { margin-bottom: 14px; }
.inp {
  width: 100%; height: 44px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 0 14px; font-size: 14px; outline: none;
  background: #fff; color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.inp:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,111,237,.12); }
.inp-title { font-size: 17px; font-weight: 600; height: 50px; }
textarea.inp { height: auto; padding: 11px 14px; resize: vertical; min-height: 96px; }
label.f-label { display: block; font-size: 13px; color: var(--text2); margin: 0 0 6px; font-weight: 500; }
.req { color: var(--danger); }
.form-hint { font-size: 12px; color: var(--text3); margin: 6px 2px 0; line-height: 1.5; }
.form-hint b { color: var(--primary); }
.form-actions { display: flex; gap: 10px; margin-top: 16px; }
.form-actions .btn { flex: 1; }

.empty {
  text-align: center; color: var(--text3);
  padding: 56px 20px;
}
.empty svg { width: 54px; height: 54px; opacity: .35; margin-bottom: 10px; }
.empty p { margin: 0; font-size: 14px; }

/* ============================================================
   仪表盘
   ============================================================ */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.dash-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 1px 3px rgba(16,24,40,.06);
  transition: transform .15s, box-shadow .15s;
}
.dash-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(16,24,40,.1); }
.dc-icon {
  width: 48px; height: 48px; flex: none;
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff;
}
.dc-icon svg { width: 24px; height: 24px; }
.dc-icon-blue { background: linear-gradient(135deg,#4f8cff,#2f6fed); }
.dc-icon-green { background: linear-gradient(135deg,#34c77b,#12a15c); }
.dc-icon-orange { background: linear-gradient(135deg,#ffb25a,#f5921b); }
.dc-icon-purple { background: linear-gradient(135deg,#a78bfa,#7c5ce7); }
.dc-info { min-width: 0; }
.dc-num { font-size: 24px; font-weight: 800; line-height: 1.1; }
.dc-label { font-size: 12px; color: var(--text3); margin-top: 2px; }

.dash-panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(16,24,40,.06);
}
.dash-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.dash-panel-head h3 { font-size: 15.5px; font-weight: 700; margin: 0; }
.dash-more { font-size: 13px; color: var(--primary); }
.dash-more:hover { text-decoration: underline; }

.dash-table-wrap { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dash-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text3);
  font-weight: 600;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.dash-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); }
.dash-table tr:last-child td { border-bottom: none; }
.dt-title { font-weight: 600; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dt-time { color: var(--text3); white-space: nowrap; }
.dt-status {
  display: inline-block;
  font-size: 11px; padding: 2px 9px; border-radius: 6px; font-weight: 600;
}
.dt-status.ok { color: #2e7d32; background: #eef7ee; }
.dt-status.draft { color: #9a6b00; background: #fff7e6; }
.dt-link { color: var(--primary); margin-right: 10px; }
.dt-link:hover { text-decoration: underline; }
.dt-empty { text-align: center; color: var(--text3); padding: 30px 12px !important; }
.dt-empty a { color: var(--primary); }

.sys-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.sys-item {
  display: flex; justify-content: space-between; gap: 10px;
  background: #f8fafc;
  border-radius: 9px;
  padding: 10px 14px;
  font-size: 13px;
}
.sys-label { color: var(--text3); }
.sys-val { font-weight: 600; word-break: break-all; text-align: right; }

/* ============================================================
   文章管理
   ============================================================ */
.admin-toolbar { margin-bottom: 16px; }
.post-list { display: flex; flex-direction: column; gap: 12px; }
.post-item {
  display: flex;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(16,24,40,.06);
}
.pi-cover { width: 100px; flex: none; min-height: 92px; background: #e6ebf2 center/cover no-repeat; }
.pi-body { flex: 1; min-width: 0; padding: 13px 16px; }
.pi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pi-title {
  font-size: 15px; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.pi-status { flex: none; font-size: 11px; padding: 2px 9px; border-radius: 6px; font-weight: 600; }
.pi-status.ok { color: #2e7d32; background: #eef7ee; }
.pi-status.draft { color: #9a6b00; background: #fff7e6; }
.pi-meta {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 6px; font-size: 12px; color: var(--text3);
}
.pi-actions { display: flex; gap: 8px; margin-top: 10px; }
.pi-actions form { margin: 0; }

/* ============================================================
   分类管理
   ============================================================ */
.cat-form-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(16,24,40,.06);
}
.cat-form-title {
  font-size: 15.5px; font-weight: 700;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.cat-list-title { font-size: 15px; font-weight: 700; margin: 0 0 12px; color: var(--text2); }
.cat-list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border-radius: 10px;
  padding: 13px 16px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(16,24,40,.06);
}
.cat-info { flex: 1; min-width: 0; }
.cat-name-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-bottom: 5px;
}
.cat-name { font-weight: 700; font-size: 15px; }
.cat-slug {
  font-size: 12px; color: var(--primary);
  background: var(--primary-bg);
  padding: 2px 9px; border-radius: 6px;
  font-family: monospace;
}
.cat-sort {
  font-size: 11px; color: var(--text3);
  background: #f0f2f7;
  padding: 2px 8px; border-radius: 5px;
}
.cat-meta-row {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  font-size: 12px; color: var(--text3);
}
.cat-count { margin: 0; }
.cat-seo { color: var(--text2); }
.cat-actions { display: flex; gap: 6px; flex: none; }
.cat-actions form { margin: 0; }

/* ============================================================
   发布 / 编辑文章（编辑器）
   ============================================================ */
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 12px 0;
  position: sticky; top: 62px; z-index: 20;
  background: var(--bg);
}
.et-btn {
  min-width: 40px; height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  transition: all .15s;
}
.et-btn:hover { border-color: var(--primary); color: var(--primary); }
.editor-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px 16px;
  min-height: 280px;
}
.editor {
  min-height: 270px;
  outline: none;
  font-size: 15px;
  line-height: 1.75;
  color: #2b2f36;
  word-break: break-word;
}
.editor img { border-radius: 8px; display: block; margin: 8px auto; max-width: 100%; }
.editor blockquote {
  margin: 10px 0; padding: 8px 12px;
  border-left: 4px solid var(--primary);
  background: #f6f8fc; color: #4b5563;
  border-radius: 0 8px 8px 0;
}
.editor:empty::before { content: attr(data-placeholder); color: var(--text3); pointer-events: none; }
.editor-footer {
  display: flex; gap: 10px;
  margin-top: 16px;
  position: sticky; bottom: 0;
  background: linear-gradient(transparent, var(--bg) 30%);
  padding: 14px 0 6px;
  z-index: 19;
}
.editor-footer .btn { flex: 1; }

/* 预览层 */
.preview-mask {
  position: fixed; inset: 0;
  background: rgba(10,16,28,.55);
  z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.preview-panel {
  width: 100%; max-width: 460px;
  height: 84%;
  background: var(--card);
  border-radius: 16px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.preview-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.preview-body { flex: 1; overflow-y: auto; padding: 18px; }
.pv-title { font-size: 19px; font-weight: 700; margin: 0 0 12px; }

/* 正文内容通用样式（预览、编辑器共用） */
.post-content { font-size: 15px; line-height: 1.75; color: #2b2f36; word-break: break-word; }
.post-content p { margin: 0 0 13px; }
.post-content h1, .post-content h2, .post-content h3, .post-content h4 {
  margin: 20px 0 10px; line-height: 1.4; font-weight: 700;
}
.post-content h1 { font-size: 20px; }
.post-content h2 { font-size: 18.5px; }
.post-content h3 { font-size: 17px; }
.post-content h4 { font-size: 15.5px; }
.post-content img { border-radius: 8px; display: block; margin: 10px auto; max-width: 100%; }
.post-content blockquote {
  margin: 13px 0; padding: 10px 14px;
  border-left: 4px solid var(--primary);
  background: #f6f8fc; color: #4b5563;
  border-radius: 0 8px 8px 0;
}
.post-content ul, .post-content ol { margin: 0 0 13px; padding-left: 22px; }
.post-content li { margin-bottom: 5px; }
.post-content a { color: var(--primary); text-decoration: underline; }
.post-content pre {
  background: #1d2129; color: #e8eaf0;
  padding: 12px 14px; border-radius: 8px;
  overflow-x: auto; font-size: 13px; line-height: 1.6;
  margin: 0 0 13px;
}
.post-content code { background: #f0f2f7; border-radius: 4px; padding: 1px 5px; font-size: 13px; }
.post-content pre code { background: none; padding: 0; color: inherit; }

/* ============================================================
   站点设置
   ============================================================ */
.settings-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(16,24,40,.06);
}
.settings-card + .settings-card { margin-top: 16px; }
.settings-title {
  font-size: 15.5px; font-weight: 700;
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.set-info { font-size: 13px; color: var(--text3); margin-top: 14px; line-height: 1.8; }
.set-info code { background: #f0f2f7; padding: 1px 6px; border-radius: 4px; color: var(--text2); }
.set-info .si-num { display: inline-block; min-width: 72px; color: var(--text3); }

/* ============================================================
   登录页
   ============================================================ */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background:
    radial-gradient(800px 500px at 20% 0%, rgba(79,140,255,.18) 0%, transparent 55%),
    radial-gradient(700px 500px at 90% 100%, rgba(47,111,237,.16) 0%, transparent 50%),
    #eef2f8;
}
.login-card {
  width: 100%; max-width: 360px;
  background: var(--card);
  border-radius: 18px;
  padding: 32px 30px;
  box-shadow: 0 16px 40px rgba(16,24,40,.12);
}
.login-logo {
  width: 56px; height: 56px; margin: 0 auto 14px;
  border-radius: 15px;
  background: linear-gradient(135deg,#4f8cff,#2f6fed);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
}
.login-logo svg { width: 32px; height: 32px; }
.login-card h1 { font-size: 18px; text-align: center; margin: 0 0 22px; color: var(--text); }
.login-err {
  background: #fdecec; color: #c0392b; font-size: 13px;
  border-radius: 9px; padding: 10px 13px; margin-bottom: 14px;
}
.login-back { text-align: center; margin: 18px 0 0; font-size: 13px; }
.login-back a { color: var(--text3); }
.login-back a:hover { color: var(--primary); }

/* ============================================================
   响应式：窄屏（含手机）折叠左侧菜单
   ============================================================ */
@media (max-width: 960px) {
  .admin-layout { flex-direction: column; }
  .admin-sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 40;
  }
  .sidebar-brand { height: 54px; }
  .sidebar-menu {
    flex-direction: row;
    overflow-x: auto;
    padding: 8px 10px;
    gap: 6px;
    scrollbar-width: none;
  }
  .sidebar-menu::-webkit-scrollbar { display: none; }
  .menu-item {
    flex: none;
    padding: 9px 13px;
    font-size: 13px;
    white-space: nowrap;
  }
  .sidebar-footer { flex-direction: row; align-items: center; justify-content: center; padding: 10px 14px; }
  .sb-copyright { padding: 4px 0; }
  .admin-topbar { height: 54px; padding: 0 14px; }
  .admin-content { padding: 16px 14px 50px; }
  .flash { margin: 12px 14px 0; }
}
