/* ============================================================
   后台管理样式（配合 style.css 变量）
   ============================================================ */
body.admin-body { background: var(--soft-2); }

.admin-top {
  background: var(--primary); color: #fff;
  position: sticky; top: 0; z-index: 50;
}
.admin-top-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 60px; gap: 12px;
}
.admin-top .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.admin-top .brand .logo-mark { width: 34px; height: 34px; font-size: 13px; }
.admin-top .user-area { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.admin-top .user-area .email { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #c8d8ea; }
.admin-top .badge {
  background: var(--accent); color: #fff; border-radius: 999px;
  font-size: 12px; padding: 2px 10px; font-weight: 600;
}
.admin-top .btn-outline {
  background: transparent; border: 1px solid rgba(255,255,255,0.5); color: #fff;
  border-radius: 6px; padding: 6px 14px; font-size: 13.5px; transition: background 0.2s;
}
.admin-top .btn-outline:hover { background: rgba(255,255,255,0.12); }

.admin-wrap { display: flex; gap: 22px; padding: 22px 0 60px; align-items: flex-start; }
.admin-side {
  width: 200px; flex-shrink: 0; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; position: sticky; top: 82px;
}
.admin-side button {
  display: block; width: 100%; text-align: left; padding: 13px 18px;
  background: none; border: none; border-left: 3px solid transparent;
  font-size: 14.5px; color: var(--text); transition: all 0.15s;
}
.admin-side button:hover { background: var(--soft); }
.admin-side button.active {
  background: var(--soft); color: var(--primary); font-weight: 600;
  border-left-color: var(--accent);
}
.admin-main { flex: 1; min-width: 0; }

.admin-sec {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 32px; margin-bottom: 20px;
}
.admin-sec h2 { font-size: 19px; color: var(--primary); margin-bottom: 4px; }
.admin-sec .sec-tip { font-size: 13.5px; color: var(--muted); margin-bottom: 22px; }

.admin-form .form-group input, .admin-form .form-group textarea, .admin-form .form-group select {
  width: 100%; border: 1px solid var(--line); border-radius: 6px;
  padding: 10px 13px; outline: none; transition: border 0.2s; background: var(--soft-2);
}
.admin-form .form-group input:focus, .admin-form .form-group textarea:focus, .admin-form .form-group select:focus {
  border-color: var(--primary); background: #fff;
}
.admin-form .form-group textarea { min-height: 90px; resize: vertical; }
.admin-form .form-group label { display: block; font-size: 14px; color: var(--primary); font-weight: 600; margin-bottom: 6px; }
.admin-form .form-group { margin-bottom: 16px; }
.admin-form .hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 400; }

.sub-card {
  border: 1px solid var(--line); border-radius: 8px; padding: 18px;
  margin-bottom: 14px; background: var(--soft-2);
}
.sub-card .row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.sub-card .row-head .t { font-size: 14px; font-weight: 600; color: var(--primary); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.btn-danger-sm {
  background: #fdeeee; color: #c0392b; border: 1px solid #f2c4c0;
  border-radius: 6px; padding: 5px 12px; font-size: 13px;
}
.btn-danger-sm:hover { background: #c0392b; color: #fff; }
.btn-ghost-sm {
  background: #fff; border: 1px dashed var(--primary); color: var(--primary);
  border-radius: 6px; padding: 8px 16px; font-size: 14px;
}
.btn-ghost-sm:hover { background: var(--soft); }

/* 图片上传 */
.img-field { display: flex; gap: 16px; align-items: center; }
.img-preview {
  width: 92px; height: 92px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff center/contain no-repeat; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 12px; overflow: hidden;
}
.img-preview img { width: 100%; height: 100%; object-fit: contain; }
.img-ops { display: flex; flex-direction: column; gap: 8px; }
.img-ops input[type="file"] { display: none; }
.img-ops .ops-row { display: flex; gap: 8px; }
.img-note { font-size: 12.5px; color: var(--muted); }

/* 保存条 */
.save-bar { display: flex; align-items: center; gap: 14px; margin-top: 8px; }
.save-state { font-size: 13.5px; }
.save-state.ok { color: #1c7c3c; }
.save-state.err { color: #c0392b; }

/* 留言列表 */
.inq-item { border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; margin-bottom: 12px; }
.inq-item .inq-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.inq-item .inq-meta { font-size: 13.5px; color: var(--primary); font-weight: 600; }
.inq-item .inq-time { font-size: 12.5px; color: var(--muted); }
.inq-item .inq-msg { font-size: 14.5px; color: var(--text); white-space: pre-wrap; word-break: break-all; }
.inq-item .inq-foot { margin-top: 10px; text-align: right; }
.inq-empty { text-align: center; color: var(--muted); padding: 30px 0; font-size: 14px; }

/* 登录页 */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background:
    linear-gradient(120deg, rgba(16,39,65,0.94), rgba(24,59,100,0.86)),
    repeating-linear-gradient(90deg, transparent 0 78px, rgba(255,255,255,0.05) 78px 79px);
}
.login-card {
  width: 420px; max-width: 100%; background: #fff; border-radius: 12px;
  padding: 38px 36px; box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-card .l-head { text-align: center; margin-bottom: 24px; }
.login-card .l-head .logo-mark { margin: 0 auto 12px; }
.login-card .l-head h1 { font-size: 20px; color: var(--primary); }
.login-card .l-head p { font-size: 13px; color: var(--muted); margin-top: 4px; }
.auth-tabs { display: flex; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.auth-tabs button {
  flex: 1; background: none; border: none; padding: 11px 0; font-size: 15px;
  color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.auth-tabs button.active { color: var(--primary); font-weight: 600; border-bottom-color: var(--accent); }
.auth-tip { font-size: 12.5px; color: var(--muted); margin-top: 14px; line-height: 1.7; }
.trust-row { display: flex; align-items: flex-start; gap: 8px; margin-top: 12px; font-size: 12.5px; color: var(--muted); line-height: 1.6; cursor: pointer; }
.trust-row input { margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }
.auth-foot { margin-top: 16px; text-align: center; font-size: 13.5px; }
.auth-foot a { color: var(--primary); font-weight: 600; }
.auth-foot a:hover { color: var(--accent); }
.login-msg { font-size: 13.5px; margin-top: 12px; padding: 9px 13px; border-radius: 6px; display: none; }
.login-msg.err { display: block; background: #fdeeee; color: #c0392b; border: 1px solid #f2c4c0; }
.login-msg.ok { display: block; background: #e8f6ec; color: #1c7c3c; border: 1px solid #bfe5cc; }

/* 密码修改弹层 */
.pw-dialog {
  position: fixed; inset: 0; background: rgba(16,39,65,0.5); z-index: 200;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.pw-dialog .dlg {
  background: #fff; border-radius: 10px; padding: 28px; width: 380px; max-width: 100%;
}
.pw-dialog h3 { color: var(--primary); margin-bottom: 16px; }

/* 语言切换条 */
.lang-tabs-bar { padding-top: 16px; }
.lang-tabs {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 14px;
}
.lang-tabs button {
  background: var(--soft-2); border: 1px solid var(--line); color: var(--muted);
  border-radius: 6px; padding: 7px 20px; font-size: 14px; cursor: pointer; transition: all 0.15s;
}
.lang-tabs button:hover { color: var(--primary); border-color: var(--primary); }
.lang-tabs button.active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.lang-tip { font-size: 12.5px; color: var(--muted); margin-left: 6px; }

/* 对话记录 */
.chatlog-item { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin-bottom: 12px; }
.chatlog-item .cl-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.chatlog-item .cl-meta { font-size: 13px; color: var(--primary); font-weight: 600; }
.chatlog-item .cl-time { font-size: 12.5px; color: var(--muted); }
.chatlog-item .cl-line { font-size: 14px; padding: 5px 0; border-top: 1px dashed var(--line); display: flex; gap: 8px; }
.chatlog-item .cl-line:first-of-type { border-top: none; }
.chatlog-item .cl-role { flex-shrink: 0; font-size: 12px; border-radius: 4px; padding: 1px 8px; height: fit-content; }
.chatlog-item .cl-role.user { background: var(--soft); color: var(--primary); }
.chatlog-item .cl-role.assistant { background: #fdeee2; color: var(--accent-dark); }
.chatlog-item .cl-text { white-space: pre-wrap; word-break: break-all; }

@media (max-width: 860px) {
  .admin-wrap { flex-direction: column; }
  .admin-side { width: 100%; position: static; display: flex; overflow-x: auto; }
  .admin-side button { white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
  .admin-side button.active { border-bottom-color: var(--accent); }
  .admin-sec { padding: 22px 18px; }
  .row-2 { grid-template-columns: 1fr; }
  .admin-top .user-area .email { display: none; }
}

/* ---------- 登录页环境提示条 ---------- */
.env-notice { display: none; }
.env-notice.warn {
  display: block;
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #fdf3e7;
  border: 1px solid #f3d3ab;
  color: #8a4b12;
  font-size: 13px;
  line-height: 1.7;
}
.env-notice.warn b { color: #6d3a08; }

/* ============================================================
   产品图集编辑器（多选上传 / 拖拽排序 / 单图删除）
   ============================================================ */
.gallery-field { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: var(--soft-2); }
.gallery-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 12px; margin-bottom: 12px;
}
.gallery-grid:empty { display: none; }
.gallery-tile {
  position: relative; aspect-ratio: 1 / 1; border-radius: 8px; overflow: hidden;
  border: 1px solid var(--line); background: #fff; cursor: grab;
  transition: box-shadow 0.2s, transform 0.2s, opacity 0.2s;
}
.gallery-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-tile:hover { box-shadow: 0 6px 18px rgba(24, 59, 100, 0.16); }
.gallery-tile.dragging { opacity: 0.42; transform: scale(0.96); }
.gallery-tile.drag-over { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(242, 112, 34, 0.35); }
.gallery-tile .gt-idx {
  position: absolute; left: 6px; top: 6px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: rgba(16, 39, 65, 0.82); color: #fff;
  font-size: 12px; line-height: 20px; text-align: center;
}
.gallery-tile .gt-del {
  position: absolute; right: 6px; top: 6px; width: 22px; height: 22px;
  border: none; border-radius: 50%; background: rgba(163, 45, 45, 0.9); color: #fff;
  font-size: 15px; line-height: 1; cursor: pointer; padding: 0;
}
.gallery-tile .gt-del:hover { background: #a32d2d; }
.gallery-tile .gt-move {
  position: absolute; left: 0; right: 0; bottom: 0; display: flex;
  background: rgba(16, 39, 65, 0.72); opacity: 0; transition: opacity 0.2s;
}
.gallery-tile:hover .gt-move { opacity: 1; }
.gallery-tile .gt-move button {
  flex: 1; border: none; background: none; color: #fff; font-size: 15px;
  line-height: 1; padding: 5px 0; cursor: pointer;
}
.gallery-tile .gt-move button:hover { background: rgba(242, 112, 34, 0.85); }
.gallery-empty {
  border: 1px dashed var(--line); border-radius: 8px; padding: 22px 16px;
  text-align: center; color: var(--muted); font-size: 13.5px; background: #fff;
}
.gallery-ops { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.gallery-ops .img-note { margin: 0; }

/* 图集就近保存：只保存本产品的图集 */
.gallery-save-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line);
}
.btn-gal-save { padding: 8px 20px; font-size: 14px; }
.gallery-save-row .img-note { margin: 0; }
.gal-save-state { font-size: 13px; color: var(--muted); }
.gal-save-state.ok { color: #1c7c3c; }
.gal-save-state.err { color: #c0392b; }
.gal-save-state.warn { color: #8a4b12; }

/* 轻提示（保存成功后弹出，2.2s 自动消失） */
.lj-toast {
  position: fixed; left: 50%; top: 26px; z-index: 9999;
  padding: 11px 22px; border-radius: 10px;
  background: rgba(16, 39, 65, 0.94); color: #fff; font-size: 14px;
  box-shadow: 0 12px 30px rgba(16, 39, 65, 0.28);
  opacity: 0; visibility: hidden; transform: translate(-50%, -12px);
  transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
  pointer-events: none;
}
.lj-toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.lj-toast.show::before { content: '✓ '; color: #7ed99b; font-weight: 700; }

/* 分类 key 标识 */
.cat-key {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px;
  background: var(--soft); color: var(--muted); font-size: 12px; font-weight: 400;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
@media (max-width: 860px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
}

/* 产品草稿标记（未填名称 = 前台不显示） */
.draft-badge {
  margin-left: 10px; padding: 2px 10px; border-radius: 999px;
  background: #fdf3e7; border: 1px solid #f3d3ab; color: #8a4b12;
  font-size: 12px; font-weight: 400;
}

/* SEO 字段字数提示（只提示、不截断） */
.seo-count { display: block; margin-top: 5px; font-size: 12px; color: var(--muted); }
.seo-count.ok { color: #1c7c3c; }
.seo-count.over { color: #8a4b12; }
