/* ============================================================
   微信自动回复客服 · 样式
   ============================================================ */

:root {
  --green: #07c160;
  --green-dark: #06ad56;
  --ink: #191919;
  --ink-2: #5b5b5b;
  --ink-3: #8a8a8a;
  --line: #e6e6e6;
  --bg: #ededed;
  --card: #ffffff;
  --warn-bg: #fff8e6;
  --warn-line: #f0d9a8;
  --warn-ink: #94660a;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #f2f3f5;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

/* ---------------------------------------------------------- 聊天页 */

.chat-page {
  background: #e9ebee;
  display: flex;
  justify-content: center;
  padding: 0;
}

.chat-main {
  width: 100%;
  max-width: 560px;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.07);
}

.chat-head {
  text-align: center;
  padding: 14px 16px 12px;
  background: #f7f7f7;
  border-bottom: 1px solid #e3e3e3;
  flex-shrink: 0;
}

.chat-head .title {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.chat-head .sub {
  font-size: 11px;
  color: var(--ink-3);
  line-height: 1.8;
  margin-top: 1px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  display: inline-block;
  margin-right: 4px;
  vertical-align: 1px;
}

.dot.busy { background: #f5a623; }

.chat-stream {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px;
  scroll-behavior: smooth;
}

.chat-stream::-webkit-scrollbar { width: 6px; }
.chat-stream::-webkit-scrollbar-thumb { background: #d0d0d0; border-radius: 3px; }

.day-line {
  text-align: center;
  font-size: 11px;
  color: #a0a0a0;
  margin: 6px 0 14px;
}

.msg-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  align-items: flex-start;
}

.msg-row.right { flex-direction: row-reverse; }

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: #9aa3ad;
  user-select: none;
}

.avatar.bot { background: #4c9aff; }
.avatar.agent { background: #7b61ff; }
.avatar.user { background: #7d8794; }

.msg-col { max-width: 74%; }

.bubble {
  position: relative;
  padding: 9px 12px;
  border-radius: 8px;
  background: var(--card);
  line-height: 1.62;
  font-size: 14px;
  word-break: break-word;
  white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.msg-row.right .bubble { background: #95ec69; }

.bubble::after {
  content: "";
  position: absolute;
  top: 12px;
  left: -5px;
  width: 9px;
  height: 9px;
  background: inherit;
  transform: rotate(45deg);
  border-radius: 1px;
}

.msg-row.right .bubble::after { left: auto; right: -5px; }

.meta-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
  font-size: 11px;
  color: #9b9b9b;
  padding-left: 2px;
}

.msg-row.right .meta-line { justify-content: flex-end; padding: 0 2px 0 0; }

.disclaimer {
  margin: 5px 2px 0;
  font-size: 11px;
  line-height: 1.55;
  color: #9c9c9c;
  padding-left: 7px;
  border-left: 2px solid #e2e2e2;
}

.msg-img {
  display: block;
  max-width: 100%;
  width: auto;
  max-height: 260px;
  border-radius: 6px;
  margin-top: 7px;
  cursor: zoom-in;
}

.tag {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
  line-height: 1.7;
  background: #eef2f7;
  color: #5b6b7f;
}

.tag.faq { background: #e7f7ed; color: #12833f; }
.tag.ai { background: #eef0ff; color: #4b46c0; }
.tag.human { background: #fff1e0; color: #9a5b09; }
.tag.handoff { background: #fdeaea; color: #b3261e; }

.sys-row {
  display: flex;
  justify-content: center;
  margin: 4px 0 14px;
}

.sys-pill {
  max-width: 86%;
  text-align: center;
  font-size: 12px;
  line-height: 1.7;
  color: var(--warn-ink);
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: 8px;
  padding: 7px 12px;
}

.typing { display: inline-flex; gap: 3px; padding: 3px 0; }
.typing i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #b9b9b9;
  animation: blink 1.2s infinite;
}
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 60%, 100% { opacity: 0.25; } 30% { opacity: 1; } }

.quick-chips {
  display: flex;
  gap: 6px;
  padding: 8px 14px 0;
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: none;
}
.quick-chips::-webkit-scrollbar { display: none; }

.quick-chips[hidden] { display: none; }

.chip {
  flex-shrink: 0;
  border: 1px solid #dcdcdc;
  background: #fff;
  color: var(--ink-2);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.chip:hover { color: var(--green); border-color: var(--green); }

.chat-foot {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 14px 12px;
  background: #f7f7f7;
  border-top: 1px solid #e3e3e3;
  flex-shrink: 0;
}

.chat-foot input {
  flex: 1;
  border: none;
  outline: none;
  background: #fff;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--ink);
}

.chat-foot input::placeholder { color: #b0b0b0; }

.send-btn {
  border: none;
  background: var(--green);
  color: #fff;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.send-btn:hover { background: var(--green-dark); }
.send-btn:disabled { background: #c6e9d5; cursor: not-allowed; }

/* ---------------------------------------------------------- 侧栏 */

.chat-side {
  width: 330px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.panel h3 {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--ink-2);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel h3 small { font-weight: 400; color: var(--ink-3); }

.kv {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  padding: 5px 0;
  color: var(--ink-2);
}

.kv b { color: var(--ink); font-weight: 600; }

.cand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-2);
  padding: 5px 0;
}

.cand .bar {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: #eef0f2;
  overflow: hidden;
}

.cand .bar span {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: 3px;
}

.cand .pct { width: 38px; text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.steps { margin: 0; padding-left: 0; list-style: none; }

.steps li {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.9;
  padding-left: 16px;
  position: relative;
}

.steps li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #d5d9de;
}

.steps li.on { color: var(--ink); }
.steps li.on::before { background: var(--green); }

.notice {
  font-size: 12px;
  line-height: 1.7;
  color: #7a6a3d;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: 8px;
  padding: 9px 11px;
}

/* ---------------------------------------------------------- 登录 */

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f2f3f5;
  padding: 20px;
}

.login-box {
  width: 340px;
  max-width: 100%;
  margin: 0;
  padding: 26px 24px 20px;
}

.login-box .brand {
  justify-content: center;
  margin-bottom: 4px;
  font-size: 16px;
}

.login-box .hint { text-align: center; margin-bottom: 18px; }

.pwd-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pwd-row code {
  flex: 1;
  background: #f2f3f5;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: ui-monospace, Consolas, monospace;
  color: var(--ink);
  letter-spacing: 0.5px;
  overflow-x: auto;
  white-space: nowrap;
}

.divider {
  height: 1px;
  background: var(--line);
  margin: 20px 0 16px;
}

/* ---------------------------------------------------------- 后台 */

.admin-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px 26px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}

.brand { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.brand .logo {
  width: 22px; height: 22px; border-radius: 6px; background: var(--green);
  display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700;
}

.tabs { display: flex; gap: 4px; background: #f2f3f5; padding: 3px; border-radius: 9px; }

.tab {
  border: none;
  background: transparent;
  padding: 7px 16px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}

.tab.active { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.admin-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.admin-main { max-width: 1080px; margin: 0 auto; padding: 22px 26px 60px; }

.view { display: none; }
.view.active { display: block; }

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar .grow { flex: 1; }

.search {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  outline: none;
  min-width: 220px;
  background: #fff;
}

.search:focus { border-color: var(--green); }

.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn:hover { border-color: #c9c9c9; background: #fafafa; }

.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }

.btn.danger { color: #c0362c; border-color: #f0c9c5; }
.btn.danger:hover { background: #fdf3f2; }

.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

table.grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
}

.table-wrap table.grid { min-width: 860px; }

table.grid th {
  text-align: left;
  padding: 11px 14px;
  background: #fafbfc;
  color: var(--ink-3);
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

table.grid td {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f1f3;
  vertical-align: top;
  line-height: 1.6;
}

table.grid tr:last-child td { border-bottom: none; }
table.grid tr:hover td { background: #fbfdfb; }

.cell-q { font-weight: 600; color: var(--ink); }
.cell-ans { color: var(--ink-2); max-width: 380px; cursor: help; }

.cell-no {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

/* 序号可以直接改：填第几位就挪到第几位 */

.cell-no { padding: 8px 6px; }

.no-input {
  width: 42px;
  padding: 3px 2px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  appearance: textfield;
  -moz-appearance: textfield;
}

.no-input::-webkit-outer-spin-button,
.no-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.no-input:hover { border-color: var(--line); background: #fff; }

.no-input:focus {
  outline: none;
  border-color: var(--green);
  background: #fff;
  color: var(--ink);
}

.cell-ops { white-space: nowrap; }
.cell-ops .btn { margin-right: 2px; }

/* 题库分页 */

.pager {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 12px 2px 4px;
  font-size: 13px;
  color: var(--ink-3);
}

.pager-info { flex-shrink: 0; white-space: nowrap; }

.pager-btns {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pager-gap { color: var(--ink-3); padding: 0 2px; }

.pager-jump {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pager-jump input {
  width: 58px;
  padding: 5px 8px;
  font-size: 13px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.pager-jump input:focus {
  border-color: var(--green);
  outline: none;
}

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  line-height: 1.8;
  background: #f2f3f5;
  color: var(--ink-2);
}

.pill.green { background: #e7f7ed; color: #12833f; }
.pill.orange { background: #fff1e0; color: #9a5b09; }
.pill.red { background: #fdeaea; color: #b3261e; }
.pill.blue { background: #eaf1fe; color: #2456bf; }

.empty {
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  padding: 50px 0;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card {
  background: #fff;
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card h2 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
}

.card .hint { font-size: 12px; color: var(--ink-3); line-height: 1.7; margin: 0 0 16px; }

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 500;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  color: var(--ink);
  background: #fff;
}

.field textarea { resize: vertical; min-height: 84px; line-height: 1.6; }

.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); }

.field .row2 { display: flex; gap: 12px; }
.field .row2 > * { flex: 1; }

.field-note { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; line-height: 1.6; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
}

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch .track {
  position: absolute;
  inset: 0;
  background: #d6d9dd;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}

.switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(18px); }

.range-row { display: flex; align-items: center; gap: 14px; }
.range-row input[type="range"] { flex: 1; accent-color: var(--green); }
.range-row b { width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

.ticket {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 12px;
  border-left: 3px solid var(--warn-line);
}

.ticket.pending { border-left-color: #f5a623; }
.ticket.replied { border-left-color: var(--green); }
.ticket.resolved { border-left-color: #d6d9dd; }

.ticket-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--ink-3);
}

.ticket-top .who { font-size: 13px; font-weight: 600; color: var(--ink); }

.ticket-q {
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink);
  background: #f7f8fa;
  border-radius: 8px;
  padding: 10px 12px;
  margin: 8px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.ticket-actions { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; }
.ticket-actions textarea {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 40px;
  outline: none;
}
.ticket-actions textarea:focus { border-color: var(--green); }

.notify-note { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }

/* ---------------------------------------------------------- 问助手 */

.assist-card { padding: 16px 18px; }

.assist-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  font-size: 14px;
}

.assist-answer {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink);
  background: #f7f8fa;
  border-radius: 8px;
  padding: 12px 14px;
}

.assist-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.assist-foot .grow { flex: 1; }

.assist-img {
  max-height: 120px;
  max-width: 40%;
  border-radius: 6px;
  border: 1px solid var(--line);
}

.assist-gallery {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

/* 缩略图尺寸写死：图片加载前后、图片本身大小不同，都不会把内容挤来挤去 */
.assist-gallery { align-items: flex-start; }

.assist-thumb {
  position: relative;
  width: 84px;
  aspect-ratio: 9 / 19;      /* 手机截图的比例，图片正好填满，看不到空出来的底色 */
  flex: 0 0 auto;
  cursor: zoom-in;
}

.assist-gallery .assist-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: inherit;
}

/* 挑选模式下才出现的选项（全选 / 拼接方向 / 合成） */
.assist-tools {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.assist-tools[hidden] { display: none; }

.assist-thumb:hover .assist-img {
  outline: 1px solid var(--green);
  outline-offset: -1px;
}

/* 挑几张模式：右上角出现勾选圈，没选的变淡 */
.assist-gallery.picking .assist-thumb { cursor: pointer; }
.assist-gallery.picking .assist-thumb:not(.picked) .assist-img { opacity: 0.4; }

.assist-tick {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  font-size: 12px;
  line-height: 17px;
  text-align: center;
  color: #fff;
}

.assist-gallery.picking .assist-tick { display: block; }
.assist-thumb.picked .assist-tick { background: var(--green); }
.assist-thumb.picked .assist-tick::after { content: "✓"; }

/* 多图合成一张长图（一次转发多张） */

.pack-mask {
  position: fixed;
  inset: 0;
  z-index: 170;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 12px;
  background: rgba(12, 14, 17, 0.9);
}

.pack-mask.open { display: flex; }

.pack-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 520px;
  max-height: 94vh;
  min-height: 0;
}

.pack-tip {
  color: #fff;
  font-size: 13px;
  line-height: 1.6;
}

.pack-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-radius: 10px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}

.pack-img { display: block; width: 100%; height: auto; }

.pack-cap {
  color: rgba(255, 255, 255, 0.62);
  font-size: 12px;
}

.pack-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.pack-actions .btn { text-decoration: none; display: inline-block; }

/* 后台：多图排序编辑器 */

.img-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 64px;
  border: 1px dashed transparent;
  border-radius: 8px;
  padding: 2px;
  transition: all 0.15s;
}

.img-list.drag-over {
  border-color: var(--green);
  background: #f2fbf6;
}

.img-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
}

.img-row img {
  width: 46px;
  height: 46px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #eee;
  flex-shrink: 0;
  cursor: zoom-in;
}

.img-row img:hover {
  border-color: var(--green);
  opacity: 0.88;
}

.img-idx {
  width: 18px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  flex-shrink: 0;
}

.img-url {
  flex: 1;
  font-size: 12px;
  color: var(--ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 后台：点缩略图看大图（放在弹窗之上、提示之下）*/

.img-viewer {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background: rgba(12, 14, 17, 0.84);
}

.img-viewer.open { display: flex; }

.img-viewer-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* 宽度也写死：底部那排按钮的左右位置不再随文件名长短变化 */
  width: min(720px, 100%);
  max-height: 100%;
  min-width: 0;
}

/* 图片框尺寸固定：换图时图片大小不同，按钮位置也不会跟着跳 */
.img-viewer-img {
  display: block;
  margin: 0 auto;
  width: 100%;
  max-width: 720px;
  height: calc(100vh - 170px);
  flex: 0 0 auto;          /* 不许被 flex 压缩，换图时高度恒定 */
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}

.img-viewer-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-size: 13px;
  min-width: 0;
}

.img-viewer-cap {
  font-weight: 600;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.img-viewer-tip {
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  flex-shrink: 0;
}

.img-viewer-btns {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}

/* 看大图时锁住背后的滚动，手机上不会跟着滑 */
body.no-scroll { overflow: hidden; }

@media (max-width: 640px) {
  .img-viewer { padding: 10px; }
  .img-viewer-img { height: calc(100vh - 120px); max-width: 100%; }
  .img-viewer-bar { gap: 8px; }
  .img-viewer-cap { font-size: 12px; }
}

/* ---------------------------------------------------------- 弹窗 */

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(20, 22, 25, 0.42);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}

.modal-mask.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 14px;
  width: 560px;
  max-width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.22);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
}

.modal-head .x {
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0 4px;
}

.modal-body { padding: 18px 20px; overflow-y: auto; }

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}

/* ---------------------------------------------------------- 提示 */

.toasts {
  position: fixed;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: rgba(28, 30, 33, 0.92);
  color: #fff;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  animation: toastIn 0.18s ease-out;
}

.toast.ok { background: rgba(18, 131, 63, 0.95); }
.toast.err { background: rgba(179, 38, 30, 0.95); }

@keyframes toastIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------- 响应式 */

@media (max-width: 900px) {
  .admin-main { padding: 16px 14px 50px; }
  .admin-head { padding: 10px 14px; gap: 10px; }
  .cell-ans { max-width: 220px; }
}
