/* ============================================================
   黄梅雅韵网 · 后台样式
   ============================================================ */
:root {
  --ink: #2b3a42; --ink-2: #55636b; --paper: #f4f2ec;
  --cinnabar: #9a3b3b; --gold: #b08d57; --line: #e2ddd0; --side: #243440;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Microsoft YaHei", "PingFang SC", sans-serif; background: var(--paper); color: var(--ink); font-size: 14px; }
a { text-decoration: none; color: inherit; }

.admin-body { display: flex; min-height: 100vh; }
.admin-side { width: 220px; background: var(--side); color: #b8c0c4; flex: none; }
.admin-brand { padding: 22px 18px; color: #fff; font-size: 15px; letter-spacing: 1px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,.08); }
.admin-brand .mark { width: 32px; height: 32px; background: var(--cinnabar); color: #fff; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 700; }
.admin-side nav { display: flex; flex-direction: column; padding: 12px 0; }
.admin-side nav a { padding: 11px 22px; font-size: 14px; border-left: 3px solid transparent; }
.admin-side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.admin-side nav a.on { background: rgba(255,255,255,.08); color: #fff; border-left-color: var(--cinnabar); }

.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-top { background: #fff; border-bottom: 1px solid var(--line); padding: 12px 26px; display: flex; justify-content: space-between; align-items: center; }
.admin-top a { color: var(--cinnabar); }
.admin-content { padding: 26px; max-width: 1100px; }

.dash-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.dash-head h2 { font-size: 19px; letter-spacing: 1px; }
.dash-head h2 small { color: var(--ink-2); font-size: 13px; font-weight: normal; margin-left: 8px; }
.dash-head .btn { margin-left: auto; }

/* 统计卡 */
.stat-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; margin-bottom: 26px; }
.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px 12px; text-align: center; transition: .2s; }
.stat-card:hover { border-color: var(--cinnabar); box-shadow: 0 6px 18px rgba(0,0,0,.06); transform: translateY(-2px); }
.stat-icon { display: inline-block; width: 40px; height: 40px; line-height: 40px; border-radius: 50%; background: var(--paper); color: var(--cinnabar); font-size: 19px; margin-bottom: 8px; }
.stat-card b { display: block; font-size: 24px; }
.stat-label { font-size: 12px; color: var(--ink-2); letter-spacing: 2px; }

.dash-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.dash-box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.dash-box h3 { font-size: 15px; margin-bottom: 10px; padding-left: 10px; border-left: 3px solid var(--cinnabar); }

/* 表格 */
.admin-table { width: 100%; border-collapse: collapse; background: #fff; }
.admin-table td, .admin-table th { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.admin-table thead th { background: #faf8f3; font-weight: normal; color: var(--ink-2); }
.admin-table-lg { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.admin-table .muted { color: var(--ink-2); font-size: 12px; }
.admin-table .ops a { color: var(--ink-2); margin-right: 10px; }
.admin-table .ops a:hover { color: var(--cinnabar); }
.admin-table .ops a.del { color: #b3563b; }
.tag-yes { background: var(--gold); color: #fff; border-radius: 4px; padding: 1px 8px; font-size: 12px; }

/* 按钮 */
.btn { display: inline-block; padding: 9px 22px; border: 1px solid transparent; border-radius: 6px; cursor: pointer; font-size: 14px; }
.btn-primary { background: var(--cinnabar); color: #fff; }
.btn-primary:hover { background: #7d2f2f; }
.btn-ghost { border-color: var(--line); background: #fff; }
.btn-ghost:hover { border-color: var(--cinnabar); color: var(--cinnabar); }

/* 表单 */
.admin-form { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 22px 26px; }
.form-row { display: flex; margin-bottom: 16px; }
.form-label { width: 110px; flex: none; padding-top: 8px; color: var(--ink-2); }
.form-label em { color: var(--cinnabar); font-style: normal; }
.form-ctl { flex: 1; }
.form-ctl input[type=text], .form-ctl input[type=password], .form-ctl input[type=date],
.form-ctl input[type=datetime-local], .form-ctl select, .form-ctl textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; outline: none; font-family: inherit;
}
.form-ctl input:focus, .form-ctl textarea:focus, .form-ctl select:focus { border-color: var(--cinnabar); }
.form-ctl textarea { resize: vertical; }
.form-ctl .ck { display: inline-flex; align-items: center; gap: 8px; padding-top: 8px; cursor: pointer; }
.hint { font-size: 12px; color: #a9a294; margin-top: 4px; }
.img-field .img-preview { display: block; width: 90px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); margin-bottom: 8px; }

/* 提示 */
.alert { padding: 11px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 14px; }
.alert-ok { background: #e8f3e8; color: #2f6b2f; border: 1px solid #cde3cd; }
.alert-err { background: #f9e9e6; color: #9a3b2f; border: 1px solid #eccfca; }

/* 分页 */
.pager { text-align: center; padding: 18px 0 4px; }
.pager a, .pager .cur { display: inline-block; min-width: 32px; padding: 5px 9px; margin: 0 3px; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.pager .cur { background: var(--cinnabar); color: #fff; border-color: var(--cinnabar); }

/* 登录页 */
.login-body { background: linear-gradient(150deg, #243440, #38464f); display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 360px; background: #fff; border-radius: 14px; padding: 36px 34px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.login-mark { width: 56px; height: 56px; background: var(--cinnabar); color: #fff; font-size: 30px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; box-shadow: inset 0 0 0 3px rgba(255,255,255,.25); }
.login-card h1 { font-size: 17px; text-align: center; letter-spacing: 2px; margin-bottom: 22px; }
.login-form label { display: block; margin-bottom: 14px; color: var(--ink-2); font-size: 13px; }
.login-form input { width: 100%; margin-top: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 14px; outline: none; }
.login-form input:focus { border-color: var(--cinnabar); }
.login-form .btn { width: 100%; margin-top: 8px; background: var(--cinnabar); color: #fff; }

/* ---------- 通用 Markdown 编辑器 ---------- */
.na-md {
	width: 100%; max-width: 1000px;
	border: 1px solid #d1d5db; border-radius: 8px; background: #fff; overflow: hidden;
}
.na-md:focus-within { border-color: #9a3b3b; box-shadow: 0 0 0 2px rgba(154,59,59,.12); }
.na-md-bar {
	display: flex; flex-wrap: wrap; align-items: center; gap: 3px;
	padding: 6px 8px; background: #f8fafc; border-bottom: 1px solid #e5e7eb;
}
.na-md-btn {
	flex: 0 0 auto; width: 28px; height: 28px; padding: 0;
	display: inline-flex; align-items: center; justify-content: center;
	border: 1px solid transparent; border-radius: 5px; background: transparent;
	color: #475569; cursor: pointer;
}
.na-md-btn svg { width: 16px; height: 16px; display: block; }
.na-md-btn:hover { background: #f1f5f9; border-color: #e2e8f0; color: var(--c, #9a3b3b); }
.na-md-btn:disabled { opacity: .55; cursor: default; }
.na-md-btn.na-md-uploading {
	width: auto; padding: 0 8px; font-size: 12px; color: #0d9488;
}
/* 标题/正文 自定义下拉（点击不失焦，光标不跳） */
.na-md-dd { flex: 0 0 auto; position: relative; }
.na-md-dd-btn {
	height: 28px; padding: 0 8px; gap: 5px;
	display: inline-flex; align-items: center;
	font-size: 12px; border: 1px solid #cbd5e1; border-radius: 5px;
	background: #fff; color: #334155; cursor: pointer;
}
.na-md-dd-btn svg { width: 13px; height: 13px; }
.na-md-dd-btn:hover { border-color: #94a3b8; background: #f8fafc; }
.na-md-dd.open .na-md-dd-btn { border-color: #9a3b3b; color: #9a3b3b; }
.na-md-menu {
	display: none; position: absolute; top: 31px; left: 0; z-index: 30;
	min-width: 118px; padding: 4px; background: #fff;
	border: 1px solid #e2e8f0; border-radius: 7px;
	box-shadow: 0 8px 24px rgba(15,23,42,.16);
}
.na-md-dd.open .na-md-menu { display: block; }
.na-md-menu button {
	width: 100%; height: 30px; padding: 0 9px; gap: 8px;
	display: flex; align-items: center; text-align: left;
	border: none; border-radius: 5px; background: transparent;
	font-size: 13px; color: #334155; cursor: pointer;
}
.na-md-menu button:hover { background: #eff6ff; color: #9a3b3b; }
.na-md-menu button.on { background: #f1f5f9; font-weight: 600; }
.na-md-menu button .na-md-hmark {
	flex: 0 0 38px; font-family: Consolas, Monaco, monospace;
	font-size: 12px; color: #94a3b8;
}
.na-md-menu button.on .na-md-hmark,
.na-md-menu button:hover .na-md-hmark { color: inherit; }
.na-md-sep { flex: 0 0 auto; width: 1px; height: 18px; margin: 0 4px; background: #cbd5e1; }

.na-md-main { display: flex; height: 380px; }
.na-md-mid .na-md-main { height: 220px; }
/* 选择器写成 .na-md textarea.na-md-input 提高优先级，压住全局 textarea.tall/.mid 的固定高度 */
.na-md textarea.na-md-input {
	flex: 1 1 50%; min-width: 0; width: auto; max-width: none;
	height: 100%; min-height: 0; margin: 0; padding: 12px 14px;
	border: none; border-radius: 0; resize: none; overflow-y: auto;
	font-family: Consolas, Monaco, "Courier New", monospace; font-size: 14px; line-height: 1.8;
	color: #1e293b; background: #fff; outline: none; word-break: break-word;
}
.na-md-split-line { flex: 0 0 1px; background: #e5e7eb; }
/* 选择器写成 .na-md .na-md-preview 提高优先级，压住旧 .md-preview 的 height:56vh/边框/圆角，让预览区撑满容器 */
.na-md .na-md-preview {
	flex: 1 1 50%; height: 100%; margin: 0; padding: 12px 18px; overflow-y: auto;
	border: none; border-radius: 0; background: #fff; font-size: 14px;
}

/* 模式切换按钮组 */
.na-md-modes {
	flex: 0 0 auto; margin-left: auto; display: inline-flex;
	border: 1px solid #cbd5e1; border-radius: 6px; overflow: hidden;
}
.na-md-modes button {
	height: 28px; padding: 0 12px; font-size: 12.5px;
	border: none; border-right: 1px solid #cbd5e1;
	background: #fff; color: #475569; cursor: pointer;
}
.na-md-modes button:last-child { border-right: none; }
.na-md-modes button:hover { background: #f1f5f9; }
.na-md-modes button.on { background: #9a3b3b; color: #fff; }

/* 编辑模式：只留输入框 */
.na-md.mode-edit .na-md-preview,
.na-md.mode-edit .na-md-split-line { display: none; }
.na-md.mode-edit .na-md-input { flex-basis: 100%; }
/* 预览模式：只留预览区 */
.na-md.mode-preview .na-md-input,
.na-md.mode-preview .na-md-split-line { display: none; }
.na-md.mode-preview .na-md-preview { flex-basis: 100%; }

/* 底部状态栏：用法提示 + 字数统计 */
.na-md-status {
	display: flex; align-items: center; justify-content: space-between; gap: 12px;
	padding: 5px 10px; border-top: 1px solid #e5e7eb; background: #fafafa;
	font-size: 12px; color: #64748b; line-height: 1.6;
}
.na-md-tip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.na-md-tip.is-err { color: #dc2626; font-weight: 600; }
.na-md-count { flex: 0 0 auto; font-variant-numeric: tabular-nums; color: #94a3b8; }

/* 全屏按钮 */
.na-md-full-btn {
	flex: 0 0 auto; margin-left: 6px; height: 28px; padding: 0 9px;
	border: 1px solid #cbd5e1; border-radius: 6px; background: #fff;
	color: #475569; font-size: 15px; line-height: 1; cursor: pointer;
}
.na-md-full-btn:hover { background: #f1f5f9; color: #9a3b3b; border-color: #9a3b3b; }

/* 全屏模式：铺满视口，编辑区占满剩余高度 */
.na-md.na-md-full {
	position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 9999;
	max-width: none; width: auto; border: none; border-radius: 0;
	display: flex; flex-direction: column; box-shadow: none;
}
.na-md.na-md-full .na-md-main { flex: 1 1 auto; height: auto; min-height: 0; }
.na-md.na-md-full .na-md-status { flex: 0 0 auto; }
body.na-md-body-lock { overflow: hidden; }

/* 拖入图片时的落区提示 */
.na-md.na-md-dragover { outline: 2px dashed #9a3b3b; outline-offset: -3px; }
.na-md.na-md-dragover .na-md-preview { background: #fdf6f2; }


/* 后台列表：搜索与分类筛选 */
.admin-filter { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 12px; flex-wrap: nowrap; }
.admin-filter .filter-form { display: flex; gap: 8px; margin: 0; align-items: center; flex: none; }
.admin-filter .filter-form input { padding: 7px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; outline: none; min-width: 180px; max-width: 280px; }
.admin-filter .filter-form .btn { border-radius: 6px; padding: 7px 16px; letter-spacing: 0; }
.admin-filter .filter-chips { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; min-width: 0; max-height: 34px; overflow: hidden; transition: max-height .25s ease; }
.admin-filter .filter-chips.open { max-height: 500px; }
.chip-toggle { flex: none; padding: 5px 14px; border: 1px dashed var(--line); border-radius: 999px; background: transparent; font-size: 13px; font-family: inherit; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.chip-toggle:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
.btn-sm { padding: 5px 12px; font-size: 13px; letter-spacing: 0; }
.chip { display: inline-block; padding: 5px 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; font-size: 13px; color: var(--ink-2); }
.chip:hover { border-color: var(--cinnabar); color: var(--cinnabar); }
.chip.on { background: var(--cinnabar); border-color: var(--cinnabar); color: #fff; }

/* ============================================================
 *  小程序积木装修
 * ============================================================ */
.dash-head { display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; }
.dash-head-ops { display:flex; gap:8px; }
.dash-head h2 small { font-size:13px; font-weight:400; color:#8a6a6a; margin-left:10px; letter-spacing:1px; }

.mp-tips { background:#fdf6f2; border:1px solid #ecd9c8; color:#7a5b46; padding:12px 16px; border-radius:8px; margin-bottom:18px; font-size:13px; line-height:1.8; }

.mp-list { display:flex; flex-direction:column; gap:8px; }
.mp-item { display:flex; align-items:center; gap:12px; background:#fff; border:1px solid #eee4dc; border-radius:10px; padding:12px 14px; transition:box-shadow .15s, opacity .15s; }
.mp-item:hover { box-shadow:0 2px 12px rgba(140,31,43,.08); }
.mp-item.off { opacity:.5; background:#fafafa; }
.mp-item.dragging { opacity:.35; }
.mp-item.over { border-color:#8c1f2b; box-shadow:0 0 0 2px rgba(140,31,43,.15); }
.mp-handle { cursor:grab; color:#bbb; font-size:15px; letter-spacing:-2px; user-select:none; padding:0 2px; }
.mp-handle:active { cursor:grabbing; }
.mp-icon { width:40px; height:40px; flex:0 0 40px; border-radius:9px; background:#fdf2ef; display:flex; align-items:center; justify-content:center; font-size:19px; }
.mp-main { flex:1; min-width:0; }
.mp-t { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.mp-t b { font-size:14px; color:#3a2b2b; }
.mp-t code { background:#f3efec; color:#8a7a70; padding:1px 6px; border-radius:4px; font-size:11px; }
.mp-title { color:#8c1f2b; font-size:13px; }
.mp-num { background:#eaf5f0; color:#266c52; font-size:11px; padding:1px 7px; border-radius:10px; }
.mp-off { background:#eee; color:#888; font-size:11px; padding:1px 7px; border-radius:10px; }
.mp-sum { font-size:12px; color:#8b8078; margin-top:4px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.mp-remark { font-size:12px; color:#a99d92; margin-top:2px; }
.mp-ops { display:flex; gap:6px; flex-shrink:0; }
.mp-btn { display:inline-block; padding:5px 11px; border:1px solid #e5dcd4; border-radius:6px; background:#fff; color:#6b5b52; font-size:12px; text-decoration:none; transition:all .15s; }
.mp-btn:hover { border-color:#8c1f2b; color:#8c1f2b; }
.mp-btn.primary { background:#8c1f2b; border-color:#8c1f2b; color:#fff; }
.mp-btn.primary:hover { background:#701823; color:#fff; }
.mp-btn.danger:hover { border-color:#c0392b; color:#c0392b; }
.mp-empty { padding:50px; text-align:center; color:#a1938a; background:#fff; border:1px dashed #e0d6cd; border-radius:10px; }
.mp-foot { margin-top:16px; font-size:12px; color:#999; }
.mp-foot code { background:#f6f2ef; padding:3px 8px; border-radius:4px; color:#7a5b46; }

/* 表单分区 */
.mp-form { max-width:920px; }
.mp-sec { background:#fff; border:1px solid #eee4dc; border-radius:10px; padding:18px 22px; margin-bottom:16px; }
.mp-sec-t { font-size:14px; font-weight:600; color:#8c1f2b; padding-bottom:10px; margin-bottom:14px; border-bottom:1px solid #f0e8e2; }
.mp-sec-t small { font-weight:400; color:#a1938a; margin-left:10px; font-size:12px; }
.mp-form .form-row { margin-bottom:14px; display:flex; gap:16px; align-items:flex-start; }
.mp-form .form-label { width:110px; flex:0 0 110px; text-align:right; padding-top:7px; color:#6b5b52; font-size:13px; }
.mp-form .form-ctl { flex:1; min-width:0; }

/* items 动态行 */
.mp-items { border:1px solid #eee4dc; border-radius:8px; padding:10px; background:#fcfaf8; }
.mp-rows { display:flex; flex-direction:column; gap:8px; }
.mp-row { display:flex; align-items:center; gap:6px; flex-wrap:wrap; background:#fff; border:1px solid #f0e9e3; border-radius:6px; padding:8px 10px; }
.mp-row input[type=text], .mp-row select { padding:5px 8px; border:1px solid #e3dbd3; border-radius:5px; font-size:13px; flex:0 0 auto; }
.mp-row input[type=text] { flex:1 1 130px; min-width:100px; }
.mp-up, .mp-del, .mp-add { cursor:pointer; text-decoration:none; user-select:none; }
.mp-up { color:#b0a49a; padding:0 4px; font-size:13px; }
.mp-up:hover { color:#8c1f2b; }
.mp-del { color:#c9bdb4; padding:2px 6px; border-radius:4px; font-size:13px; }
.mp-del:hover { color:#c0392b; background:#fdf0ee; }
.mp-add { display:inline-block; margin-top:8px; padding:5px 14px; border:1px dashed #d5c8bd; border-radius:6px; color:#8c1f2b; font-size:12px; background:#fff; }
.mp-add:hover { border-color:#8c1f2b; background:#fdf6f4; }

/* 图片 / 颜色 / 图标 控件 */
.mp-img { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.mp-img input[type=text] { flex:1 1 200px; min-width:150px; }
.mp-img input[type=file] { font-size:12px; max-width:190px; }
.mp-uptip { font-size:12px; }
.mp-prev { width:44px; height:32px; object-fit:cover; border-radius:4px; border:1px solid #eee; }
.mp-color { width:44px; height:32px; padding:2px; border:1px solid #ddd; border-radius:5px; background:#fff; vertical-align:middle; }
.mp-color-txt { margin-left:8px; width:190px; }
.mp-icon-inp { width:100px; }
.mp-ta { width:100%; }

/* 选类型卡片 */
.mp-cat { margin-bottom:20px; }
.mp-cat-t { font-size:13px; color:#7a6b60; margin-bottom:10px; padding-left:4px; border-left:3px solid #8c1f2b; }
.mp-cat-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(210px, 1fr)); gap:10px; }
.mp-type-card { display:block; background:#fff; border:1px solid #eee4dc; border-radius:10px; padding:14px 16px; text-decoration:none; transition:all .15s; }
.mp-type-card:hover { border-color:#8c1f2b; box-shadow:0 3px 14px rgba(140,31,43,.1); transform:translateY(-1px); }
.mp-type-ic { font-size:22px; display:block; margin-bottom:6px; }
.mp-type-card b { display:block; font-size:14px; color:#3a2b2b; }
.mp-type-card small { display:block; font-size:12px; color:#968980; margin-top:4px; line-height:1.5; min-height:34px; }
.mp-type-card code { font-size:11px; color:#b3a79e; }

@media (max-width:900px) {
  .mp-item { flex-wrap:wrap; }
  .mp-ops { width:100%; padding-left:52px; }
  .mp-form .form-row { flex-direction:column; gap:6px; }
  .mp-form .form-label { width:auto; text-align:left; padding-top:0; }
}
