/* ============ 万能单页系统 全局样式 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #2f6fed;
  --primary-dark: #1e56c9;
  --danger: #e6392d;
  --success: #16a34a;
  --warn: #d97706;
  --bg: #f3f5f9;
  --card: #ffffff;
  --border: #e5e8ef;
  --text: #1f2733;
  --muted: #7b8494;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
}
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { opacity: .85; }

/* ---- 顶部导航 ---- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 28px; height: 58px;
}
.brand { font-size: 17px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #ff5a36, #ff9a3c);
  color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 15px;
}
.topnav { display: flex; gap: 4px; flex: 1; }
.topnav a {
  padding: 7px 14px; border-radius: 8px; color: var(--muted); font-weight: 500;
}
.topnav a:hover { background: #f0f3f9; color: var(--text); opacity: 1; }
.topnav a.active { background: #eaf1ff; color: var(--primary); }
.topnav a .plus { margin-right: 4px; }
.topbar .tag {
  font-size: 12px; color: var(--muted); background: #f3f5f9; border: 1px solid var(--border);
  padding: 3px 10px; border-radius: 20px;
}

/* ---- 布局 ---- */
.container { max-width: 1200px; margin: 24px auto; padding: 0 20px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-title { font-size: 21px; font-weight: 700; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.card + .card { margin-top: 16px; }

/* ---- 按钮 ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 8px 16px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; font-weight: 500; cursor: pointer; background: #fff; color: var(--text);
  transition: all .15s; white-space: nowrap; font-family: inherit;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-danger { background: #fff; color: var(--danger); border-color: #f3c2bd; }
.btn-danger:hover:not(:disabled) { background: #fef2f1; }
.btn-ghost { border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: #c9d2e0; background: #f7f9fc; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }

/* ---- 工具条 ---- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input[type=text], .toolbar select {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px;
  background: #fff; outline: none; font-family: inherit;
}
.toolbar input[type=text]:focus, .toolbar select:focus { border-color: var(--primary); }
.toolbar .search-box { position: relative; }
.toolbar .search-box input { padding-left: 34px; width: 240px; }
.toolbar .search-box .icon { position: absolute; left: 11px; top: 9px; color: var(--muted); font-size: 14px; }
.toolbar .spacer { flex: 1; }
.seg { display: inline-flex; background: #eef1f6; border-radius: 8px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; padding: 6px 14px; border-radius: 6px; cursor: pointer;
  color: var(--muted); font-size: 13px; font-family: inherit;
}
.seg button.active { background: #fff; color: var(--text); font-weight: 600; box-shadow: var(--shadow); }

/* ---- 表格 ---- */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th, table.list td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.list th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafbfd; white-space: nowrap; }
table.list tr:hover td { background: #fafcff; }
table.list td.name { font-weight: 600; }
.link-cell { display: flex; align-items: center; gap: 8px; min-width: 220px; }
.link-cell code { background: #f3f5f9; border: 1px solid var(--border); padding: 3px 8px; border-radius: 6px; font-size: 12px; color: #3b4a5e; overflow: hidden; text-overflow: ellipsis; max-width: 240px; white-space: nowrap; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.badge-active { background: #e8f7ee; color: var(--success); }
.badge-active::before { background: var(--success); }
.badge-inactive { background: #f5f5f6; color: var(--muted); }
.badge-inactive::before { background: #a7aebc; }
.muted { color: var(--muted); font-size: 12px; }
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 10px; }

/* ---- 弹窗 ---- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; max-width: 560px; width: 100%;
  max-height: 88vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16px; }
.modal-close { border: 0; background: none; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---- 表单 ---- */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 13px; }
.form-group .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
input[type=text], input[type=password], input[type=number], input[type=color], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(47,111,237,.1); }
textarea { resize: vertical; min-height: 90px; }
.f-row { display: flex; gap: 10px; align-items: center; }
.f-row > * { flex: 1; }
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type=color] { width: 48px; height: 36px; padding: 2px; border-radius: 6px; cursor: pointer; }

/* ---- 提示条 ---- */
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
.flash-success { background: #e8f7ee; color: #166534; border: 1px solid #bbe8cd; }
.flash-error { background: #fef2f1; color: #b3261e; border: 1px solid #f5c6c2; }

/* ---- 编辑器 ---- */
.editor-layout { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
.palette { position: sticky; top: 74px; }
.palette .cat { font-size: 12px; color: var(--muted); font-weight: 700; margin: 14px 0 8px; text-transform: uppercase; letter-spacing: .4px; }
.palette .cat:first-child { margin-top: 0; }
.palette-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 9px; margin-bottom: 8px; cursor: pointer; background: #fff; transition: all .15s;
}
.palette-item:hover { border-color: var(--primary); background: #f5f9ff; }
.palette-item .pi { width: 32px; height: 32px; border-radius: 8px; background: #eef3ff; color: var(--primary); display: flex; align-items: center; justify-content: center; font-size: 16px; flex: none; }
.palette-item .pt { font-size: 13px; font-weight: 600; }
.palette-item .pd { font-size: 11px; color: var(--muted); }

.canvas-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.canvas-head .left { display: flex; align-items: center; gap: 10px; }
.canvas-head input[type=text] { width: 240px; }

.editor-toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px;
  background: #fff; border: 1px solid var(--border); border-radius: 10px 10px 0 0; border-bottom: 0;
}
.module-list { min-height: 200px; }
.module-card {
  background: #fff; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 12px;
  overflow: hidden; box-shadow: var(--shadow);
}
.module-card.dragging { opacity: .6; border-style: dashed; }
.mc-head {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #fafbfd;
  border-bottom: 1px solid var(--border); cursor: move;
}
.mc-head .mc-type { font-weight: 600; font-size: 13px; flex: 1; }
.mc-head .mc-tools { display: flex; gap: 4px; }
.mc-head button {
  border: 1px solid var(--border); background: #fff; border-radius: 6px; width: 26px; height: 26px;
  cursor: pointer; color: var(--muted); font-size: 13px; line-height: 1;
}
.mc-head button:hover { color: var(--primary); border-color: var(--primary); }
.mc-head button.del:hover { color: var(--danger); border-color: var(--danger); }
.mc-body { padding: 12px 14px; }
.mc-preview { font-size: 13px; color: #374151; }
.mc-preview img { max-width: 120px; border-radius: 8px; display: block; }
.mc-preview .tkl { background: #f3f5f9; border: 1px dashed #c9d2e0; padding: 6px 10px; border-radius: 6px; margin-top: 6px; font-size: 12px; word-break: break-all; }

/* 编辑器画布（模拟手机） */
.phone-frame {
  max-width: 420px; margin: 0 auto; border: 1px solid #d5dbe6; border-radius: 16px;
  background: #fff; overflow: hidden; box-shadow: 0 8px 30px rgba(0,0,0,.08);
}
.phone-frame .pf-head { background: #fafbfd; border-bottom: 1px solid var(--border); text-align: center; font-size: 13px; color: var(--muted); padding: 8px; }
.phone-frame .pf-body { min-height: 400px; }

/* 编辑弹窗内联预览 */
.inline-preview { margin-top: 8px; border: 1px dashed var(--border); border-radius: 8px; overflow: hidden; max-width: 320px; }

/* ---- 模板库 ---- */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.tpl-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow); transition: all .15s;
}
.tpl-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16,24,40,.1); }
.tpl-cover {
  height: 140px; background: linear-gradient(135deg, #ff5a36, #ff9a3c); display: flex;
  align-items: center; justify-content: center; color: #fff; font-size: 40px; position: relative;
}
.tpl-cover.c2 { background: linear-gradient(135deg, #2f6fed, #38bdf8); }
.tpl-cover.c3 { background: linear-gradient(135deg, #7b2ff7, #c084fc); }
.tpl-cover.c4 { background: linear-gradient(135deg, #0e9594, #4ecdc4); }
.tpl-cover .tpl-icon { opacity: .95; }
.tpl-cover .tpl-tag { position: absolute; left: 10px; bottom: 10px; font-size: 11px; background: rgba(0,0,0,.25); padding: 2px 8px; border-radius: 20px; }
.tpl-body { padding: 14px 16px; flex: 1; display: flex; flex-direction: column; }
.tpl-body h3 { font-size: 15px; margin-bottom: 4px; }
.tpl-body .tpl-cat { font-size: 12px; color: var(--primary); margin-bottom: 6px; }
.tpl-body p { font-size: 13px; color: var(--muted); flex: 1; }
.tpl-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 12px; }
.tpl-tags span { background: #f3f5f9; color: var(--muted); font-size: 11px; padding: 2px 8px; border-radius: 20px; }
.tpl-foot { display: flex; gap: 8px; }
.cat-title { font-size: 16px; font-weight: 700; margin: 28px 0 14px; }
.cat-title:first-child { margin-top: 0; }

/* ---- 克隆页 ---- */
.clone-steps { display: flex; gap: 12px; margin-bottom: 22px; }
.clone-steps .step { flex: 1; background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: flex; gap: 12px; align-items: flex-start; }
.clone-steps .num { width: 26px; height: 26px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex: none; }
.clone-steps .step h4 { font-size: 14px; margin-bottom: 3px; }
.clone-steps .step p { font-size: 12px; color: var(--muted); }
.result-box { text-align: center; padding: 26px; }
.result-box .r-num { font-size: 34px; font-weight: 800; }
.result-box .r-success { color: var(--success); }
.result-box .r-fail { color: var(--danger); }
.result-list { margin-top: 16px; text-align: left; max-height: 260px; overflow: auto; }
.result-list li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.notice { background: #fff8e6; border: 1px solid #f5e0a8; color: #8a6d1a; padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }

/* ---- 落地页（消费者视角）---- */
.lp-wrap { min-height: 100vh; background: #f4f4f5; }
.lp { max-width: 480px; margin: 0 auto; background: #fff; min-height: 100vh; box-shadow: 0 0 30px rgba(0,0,0,.08); }
.lp-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #fff; border-bottom: 1px solid #f0f0f0; font-size: 13px; color: #333; position: sticky; top: 0; z-index: 10; }
.lp-bar .brand-mini { font-weight: 600; }
.lp-bar .visit { color: #999; font-size: 12px; }
.lp-mod { padding: 0 0; }
.lp-announce { padding: 10px 16px; font-size: 14px; text-align: center; }
.lp-image img { width: 100%; display: block; }
.lp-richtext { padding: 16px; }
.lp-richtext h1, .lp-richtext h2, .lp-richtext h3 { margin: 8px 0; }
.lp-richtext p { margin: 6px 0; }
.lp-combo { padding: 14px 16px; background: #fafafa; border-top: 1px solid #f0f0f0; border-bottom: 1px solid #f0f0f0; }
.lp-combo h4 { margin-bottom: 8px; }
.lp-steps { display: flex; gap: 0; margin: 10px 0; }
.lp-steps .s { flex: 1; text-align: center; font-size: 12px; color: #666; position: relative; }
.lp-steps .s .dot { width: 24px; height: 24px; border-radius: 50%; background: #ff5a36; color: #fff; display: flex; align-items: center; justify-content: center; margin: 0 auto 6px; font-size: 12px; font-weight: 600; }
.lp-steps .s:not(:last-child)::after { content: ""; position: absolute; top: 12px; left: 60%; width: 80%; height: 2px; background: #ffe1d6; }
.tkl-box {
  background: #fff; border: 2px dashed #ff5a36; border-radius: 10px; padding: 12px; margin-top: 10px;
  font-size: 13px; word-break: break-all; cursor: pointer; user-select: all;
}
.tkl-box .tkl-label { font-size: 11px; color: #999; display: block; margin-bottom: 4px; }
.lp-video { padding: 16px; }
.lp-video .video-cover { position: relative; border-radius: 10px; overflow: hidden; background: #000; }
.lp-video .video-cover img { width: 100%; display: block; opacity: .7; }
.lp-video .play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 44px; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.lp-divider { padding: 10px 16px; display: flex; align-items: center; gap: 10px; color: #c4c4c4; }
.lp-divider::before, .lp-divider::after { content: ""; flex: 1; border-top: 1px solid #eee; }
.lp-btn { padding: 12px 16px 30px; }
.lp-btn button {
  width: 100%; padding: 14px; border: 0; border-radius: 12px; font-size: 16px; font-weight: 700;
  background: linear-gradient(135deg, #ff5a36, #ff8a3c); color: #fff; cursor: pointer;
  box-shadow: 0 6px 16px rgba(255,90,54,.35);
}
.lp-footer { text-align: center; color: #bbb; font-size: 12px; padding: 16px; }

/* 落地页验证码门禁 */
.gate {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.gate-box { width: 100%; max-width: 360px; background: #fff; border-radius: 16px; padding: 28px; box-shadow: 0 10px 40px rgba(0,0,0,.1); text-align: center; }
.gate-box .lock { font-size: 42px; margin-bottom: 10px; }
.gate-box h2 { font-size: 17px; margin-bottom: 6px; }
.gate-box p { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.gate-box .err { color: var(--danger); font-size: 13px; margin-top: 10px; }
.gate-tip { margin-top: 14px; font-size: 11px; color: #bbb; }

/* ---- 响应式 ---- */
@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 1fr; }
  .palette { position: static; }
  .palette .cats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .palette .cat { grid-column: 1 / -1; }
  .toolbar .search-box input { width: 160px; }
}
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 200;
  background: #1f2733; color: #fff; padding: 10px 20px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.2); animation: fadein .2s;
}
@keyframes fadein { from { opacity: 0; transform: translate(-50%,-8px);} to { opacity: 1; transform: translate(-50%,0);} }
