/* ============================================================
   公众号管理系统 · 现代化 UI（HTML5）
   主色：微信绿 #07c160
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: #f0f2f5;
  color: #303133;
  font-size: 14px;
  line-height: 1.6;
}

/* ---------- 顶部导航 ---------- */
.topbar { background: linear-gradient(135deg, #07c160 0%, #05a854 100%); color: #fff; box-shadow: 0 2px 10px rgba(7,193,96,.25); position: sticky; top: 0; z-index: 100; }
.topbar-inner { max-width: 1000px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 18px; }
.topbar .brand { font-size: 18px; font-weight: 700; letter-spacing: .5px; }
.topbar nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.topbar nav a { color: #fff; text-decoration: none; font-size: 14px; padding: 6px 12px; border-radius: 6px; transition: background .15s; }
.topbar nav a:hover { background: rgba(255,255,255,.18); }
.topbar nav .me { font-size: 13px; opacity: .92; padding: 0 8px; }
.topbar nav .logout { border: 1px solid rgba(255,255,255,.5); }

/* ---------- 布局 ---------- */
.container { max-width: 1000px; margin: 22px auto 40px; padding: 0 16px; }
.card { background: #fff; border-radius: 12px; padding: 20px; margin: 16px 0; box-shadow: 0 1px 3px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04); border: 1px solid #f0f0f0; }
h2 { margin: 4px 0 14px; font-size: 20px; font-weight: 700; }
h3 { margin: 0 0 12px; font-size: 15px; font-weight: 600; color: #1f2329; }
p { margin: 4px 0; }

/* ---------- 表单 ---------- */
label { display: block; font-weight: 600; margin: 14px 0 6px; font-size: 13px; color: #4a4f57; }
input[type=text], input[type=password], input[type=tel], textarea, select {
  width: 100%; padding: 10px 12px; border: 1px solid #dcdfe6; border-radius: 8px; font-size: 14px;
  font-family: inherit; color: #303133; background: #fff; transition: border-color .15s, box-shadow .15s; outline: none;
}
input:focus, textarea:focus, select:focus { border-color: #07c160; box-shadow: 0 0 0 3px rgba(7,193,96,.12); }
textarea { min-height: 84px; resize: vertical; }
select { cursor: pointer; }

/* ---------- 按钮 ---------- */
button, .btn {
  display: inline-block; background: #07c160; color: #fff; border: 0; padding: 10px 20px; border-radius: 8px;
  cursor: pointer; font-size: 14px; font-family: inherit; text-decoration: none; transition: background .15s, transform .05s, box-shadow .15s;
}
button:hover, .btn:hover { background: #06ad56; box-shadow: 0 2px 8px rgba(7,193,96,.3); }
button:active, .btn:active { transform: scale(.97); }
button:disabled, .btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.ghost { background: #fff; color: #07c160; border: 1px solid #07c160; }
.btn.ghost:hover { background: #f0faf4; box-shadow: none; }
.btn.mini { padding: 4px 12px; font-size: 13px; border-radius: 6px; }
.btn.danger { background: #f56c6c; }
.btn.danger:hover { background: #e64f4f; }
.btn-del { background: none; border: 0; color: #c0c4cc; cursor: pointer; font-size: 15px; padding: 2px 8px; border-radius: 6px; }
.btn-del:hover { color: #f56c6c; background: #fef0f0; }
.form { max-width: 560px; }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; }
.tbl th, .tbl td { padding: 11px 12px; text-align: left; border-bottom: 1px solid #f0f0f0; font-size: 14px; vertical-align: top; }
.tbl th { background: #fafbfc; font-weight: 600; color: #606266; font-size: 13px; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #f7faf8; }
.tbl .ops a { margin-right: 12px; color: #07c160; text-decoration: none; font-size: 13px; }
.tbl .ops a:hover { text-decoration: underline; }
.tbl .ops a.del { color: #f56c6c; }
.muted-row td { color: #c0c4cc; }
.row-cur { background: #f0faf4 !important; }

/* ---------- 提示 / 徽章 ---------- */
.alert { padding: 11px 14px; border-radius: 8px; margin: 12px 0; font-size: 14px; border: 1px solid transparent; }
.alert-ok { background: #f0faf4; color: #07a353; border-color: #d8f2e2; }
.alert-err { background: #fef0f0; color: #e64340; border-color: #fadcdc; }
.muted { color: #909399; font-size: 13px; }
.code, code { background: #f4f5f7; padding: 2px 7px; border-radius: 5px; font-size: 13px; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.tag { display: inline-block; background: #07c160; color: #fff; padding: 2px 10px; border-radius: 20px; font-size: 12px; white-space: nowrap; }
.tag.gray { background: #909399; }
.tag.badge { background: #fff5e6; color: #b88230; border: 1px solid #f5dfae; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.sub2 { margin-top: 3px; font-size: 12px; color: #909399; }
.foot { text-align: center; color: #b0b3b8; font-size: 12px; padding: 24px 0 30px; }

/* ---------- 菜单编辑器 ---------- */
.menu-editor-wrap { display: flex; gap: 18px; align-items: flex-start; }
.menu-editor-left { flex: 1; min-width: 0; }
.menu-editor-right { width: 300px; flex-shrink: 0; }
.menu-editor-right .card { position: sticky; top: 70px; }
.drag-handle { cursor: grab; color: #c0c4cc; font-size: 14px; letter-spacing: -3px; padding: 0 4px; user-select: none; }
.drag-handle:active { cursor: grabbing; color: #07c160; }
.top-card { border: 1px solid #e8eaed; border-radius: 10px; padding: 14px; margin-bottom: 12px; background: #fdfdfd; transition: border-color .15s; }
.top-card:hover { border-color: #d0d5db; }
.top-card.dragging { opacity: .45; }
.top-card.drag-over { border-color: #07c160; box-shadow: 0 0 0 2px rgba(7,193,96,.18); }
.top-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.top-head .top-name { flex: 1; min-width: 120px; }
.top-head select { width: auto; min-width: 155px; }
.field-grid { display: grid; grid-template-columns: 110px 1fr; gap: 7px 12px; align-items: center; margin: 4px 0 8px; }
.field-grid label { margin: 0; font-size: 13px; color: #606266; text-align: right; white-space: nowrap; }
.field-grid input { padding: 8px 10px; }
.subs { margin: 10px 0 0; border-left: 2px solid #07c160; padding-left: 14px; }
.sub-row { display: flex; gap: 8px; align-items: center; }
.sub-row.dragging { opacity: .45; }
.sub-row.drag-over { outline: 2px dashed #07c160; outline-offset: 2px; border-radius: 8px; }
.sub-row .sub-name { flex: 1; min-width: 100px; }
.sub-row select { width: auto; min-width: 135px; }
.sub-field { margin-top: 2px; }
.add-sub { margin-top: 10px; }
.dragging-src { opacity: .4; }

/* 手机预览 */
.phone { width: 100%; max-width: 280px; margin: 0 auto; border: 8px solid #26282b; border-radius: 26px; overflow: hidden; background: #ededed; box-shadow: 0 6px 20px rgba(0,0,0,.18); }
.phone-head { background: #07c160; color: #fff; text-align: center; font-size: 14px; padding: 13px 8px; font-weight: 600; }
.phone-body { min-height: 210px; background: #f7f7f7; display: flex; align-items: center; justify-content: center; padding: 12px; text-align: center; font-size: 12px; }
.phone-menu { display: flex; background: #fff; border-top: 1px solid #e2e2e2; position: relative; }
.mbtn-wrap { flex: 1; position: relative; }
.mbtn { text-align: center; padding: 12px 2px; font-size: 13px; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: default; }
.mbtn.has-sub { background: linear-gradient(#f2f2f2, #fff); }
.mbtn-subs { display: none; position: absolute; bottom: 100%; left: 0; right: 0; background: #fff; border: 1px solid #ddd; border-radius: 8px 8px 0 0; box-shadow: 0 -3px 10px rgba(0,0,0,.08); z-index: 5; }
.mbtn-subs .mbtn { border-bottom: 1px solid #f0f0f0; }
.mbtn-subs .mbtn:last-child { border-bottom: 0; }
.mbtn-wrap:hover .mbtn-subs { display: block; }

/* ---------- 统计卡片 ---------- */
.stat-cards { display: flex; gap: 12px; flex-wrap: wrap; margin: 16px 0; }
.stat-card { flex: 1; min-width: 140px; background: #fff; border-radius: 12px; padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04); text-align: center; border: 1px solid #f0f0f0; }
.stat-card .num { font-size: 28px; font-weight: 800; color: #07c160; letter-spacing: .5px; }
.stat-card.bad .num { color: #f56c6c; }
.stat-card .lab { font-size: 12px; color: #909399; margin-top: 5px; }

/* 趋势柱状图 */
.trend-chart { display: flex; gap: 10px; align-items: flex-end; height: 130px; padding-top: 6px; }
.trend-day { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.trend-bars { flex: 1; display: flex; gap: 5px; align-items: flex-end; width: 100%; justify-content: center; }
.trend-bars .bar { width: 16px; border-radius: 4px 4px 0 0; min-height: 3px; transition: height .3s; }
.bar.add { background: linear-gradient(#07c160, #37d380); }
.bar.unsub { background: linear-gradient(#f56c6c, #f79c9c); }
.trend-lab { font-size: 11px; color: #909399; margin-top: 6px; }

/* ---------- 粉丝 / 头像 / 分页 ---------- */
.avatar { width: 36px; height: 36px; border-radius: 50%; vertical-align: middle; margin-right: 10px; object-fit: cover; border: 1px solid #eee; }
.muted-row .avatar { opacity: .4; }
.pager { margin-top: 14px; display: flex; gap: 6px; flex-wrap: wrap; }
.pager a { display: inline-block; min-width: 30px; text-align: center; padding: 6px 9px; border: 1px solid #dcdfe6; border-radius: 7px; text-decoration: none; color: #303133; font-size: 13px; background: #fff; }
.pager a:hover { border-color: #07c160; color: #07c160; }
.pager a.cur { background: #07c160; color: #fff; border-color: #07c160; }

/* ---------- 聊天记录 ---------- */
.chat-box { display: flex; flex-direction: column; gap: 12px; max-height: 560px; overflow-y: auto; padding: 14px 6px 6px; }
.chat-row { display: flex; }
.chat-row.me { justify-content: flex-end; }
.chat-row.bot { justify-content: flex-start; }
.bubble { max-width: 78%; padding: 10px 14px; border-radius: 12px; font-size: 14px; word-break: break-word; position: relative; box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.chat-row.me .bubble { background: #07c160; color: #fff; border-bottom-right-radius: 4px; }
.chat-row.bot .bubble { background: #fff; border: 1px solid #eceff2; border-bottom-left-radius: 4px; }
.bubble .ctime { font-size: 11px; opacity: .65; margin-top: 6px; text-align: right; }
.chat-row.me .bubble .ctime { color: #eafff3; }
.chat-row.bot .bubble .ctime { color: #909399; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .menu-editor-wrap { flex-direction: column; }
  .menu-editor-right { width: 100%; }
  .menu-editor-right .card { position: static; }
  .top-head { flex-wrap: wrap; }
  .field-grid { grid-template-columns: 1fr; }
  .field-grid label { text-align: left; }
  .topbar-inner { justify-content: center; text-align: center; }
}
@media (max-width: 480px) {
  .container { padding: 0 10px; }
  .stat-card { min-width: calc(50% - 8px); }
  .card { padding: 14px; }
}
.hidden { display: none; }
