/* ===== 后台管理样式 ===== */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f5fa;
  color: #1f2330;
}

/* 登录 */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
}
.login-box {
  background: #fff;
  padding: 36px 32px;
  border-radius: 16px;
  width: 340px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .15);
  text-align: center;
}
.login-box h2 { margin: 0 0 4px; }
.login-sub { color: #6b7280; margin: 0 0 20px; font-size: 14px; }
.login-box input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e6e8f0;
  border-radius: 10px;
  font-size: 15px;
  margin-bottom: 14px;
  outline: none;
}
.login-box input:focus { border-color: #6366f1; }
.login-error { color: #ef4444; font-size: 13px; min-height: 18px; margin: 6px 0; }
.back-link { display: inline-block; margin-top: 8px; color: #6366f1; font-size: 13px; text-decoration: none; }

/* 顶栏 */
.admin-header {
  background: #fff;
  border-bottom: 1px solid #e6e8f0;
  position: sticky;
  top: 0;
  z-index: 20;
}
.admin-header-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.build-tag {
  font-weight: 500;
  font-size: 11px;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 999px;
  background: #eef0ff;
  color: #4f46e5;
  border: 1px solid #dfe3ff;
}
.actions { display: flex; gap: 10px; }

/* 列表 */
.admin-main { padding: 24px 20px 60px; }
.page-list-wrap {
  background: #fff;
  border: 1px solid #e6e8f0;
  border-radius: 14px;
  padding: 18px 20px;
}
.list-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.list-head h3 { margin: 0; }
.count { color: #6b7280; font-size: 13px; }
.order-msg { color: #16a34a; font-size: 13px; }
.list-tip {
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #f5f6fd;
  border: 1px dashed #d9dcf0;
  border-radius: 10px;
  color: #5b6172;
  font-size: 13px;
}
.list-tip b { color: #4f46e5; }

.page-items { list-style: none; margin: 0; padding: 0; }
.page-items li.item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px;
  border-bottom: 1px solid #f0f1f7;
}
.page-items li.item:last-child { border-bottom: none; }
.page-items li.item.is-home {
  background: linear-gradient(90deg, rgba(99, 102, 241, .07), rgba(99, 102, 241, 0));
  border-left: 3px solid #6366f1;
  border-radius: 8px;
}
.item-order { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.ord-btn {
  width: 26px;
  height: 20px;
  line-height: 1;
  font-size: 10px;
  border: 1px solid #e6e8f0;
  background: #fff;
  color: #6b7280;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
}
.ord-btn:hover:not(:disabled) { border-color: #6366f1; color: #6366f1; }
.ord-btn:disabled { opacity: .3; cursor: not-allowed; }

.item-info { min-width: 0; flex: 1; }
.item-title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  line-height: 18px;
}
.badge-home { background: #6366f1; color: #fff; }
.badge-lock { background: #eef0f6; color: #6b7280; }
.item-meta { color: #6b7280; font-size: 13px; word-break: break-all; }
.item-actions { display: flex; gap: 8px; flex-shrink: 0; }
.loading { color: #6b7280; padding: 14px 12px; }

/* 编辑器顶部提示 */
.editor-note {
  display: none;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: #f5f6fd;
  border: 1px solid #e0e3f7;
  border-radius: 10px;
  color: #4f46e5;
  font-size: 13px;
}
.editor-note code {
  background: #fff;
  padding: 1px 6px;
  border-radius: 4px;
}

/* 弹窗 */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 30, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-dialog {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 820px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
}
.editor-dialog { max-width: 900px; }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #eef0f6;
}
.modal-header h3 { margin: 0; font-size: 17px; }
.modal-close {
  border: none;
  background: transparent;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  color: #9aa0b4;
}
.modal-close:hover { color: #1f2330; }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid #eef0f6;
}
.editor-msg { margin-right: auto; font-size: 13px; color: #6b7280; }

.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.form-row label small { font-weight: 400; color: #9aa0b4; }
.form-row input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e6e8f0;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
}
.form-row input:focus { border-color: #6366f1; }

.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.editor-toolbar span { font-weight: 600; font-size: 14px; }
.editor-toolbar small { font-weight: 400; color: #9aa0b4; }

#html-input {
  width: 100%;
  min-height: 360px;
  border: 1px solid #e6e8f0;
  border-radius: 10px;
  padding: 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
  outline: none;
}
.hint { color: #9aa0b4; font-size: 12px; margin: 8px 0 0; }
.hint code {
  background: #f1f2f8;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
}

/* CodeMirror 高度 */
.CodeMirror {
  border: 1px solid #e6e8f0;
  border-radius: 10px;
  min-height: 360px;
  font-size: 13px;
  height: auto;
}

/* 组件面板 */
.snippets-dialog { max-width: 760px; }
.snippets-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.snip-cat {
  border: 1px solid #e6e8f0;
  background: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
}
.snip-cat.active { background: #6366f1; color: #fff; border-color: #6366f1; }
.snippets-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.snip-card {
  border: 1px solid #e6e8f0;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.snip-card:hover { border-color: #6366f1; box-shadow: 0 6px 18px rgba(99,102,241,.12); }
.snip-card h4 { margin: 0 0 6px; font-size: 15px; }
.snip-card p { margin: 0; color: #6b7280; font-size: 12px; }
