/* 基础样式与设计变量：前台 H5 与后台管理共用 */

:root {
  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;
  --rose-600: #e11d48;
  --rose-50: #fff1f2;
  --amber-700: #b45309;
  --amber-50: #fffbeb;
  --emerald-700: #047857;
  --emerald-50: #ecfdf5;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --text: #1f2937;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --line: #e5e7eb;
  --line-soft: #f1f5f9;
  --bg: #f6f8fb;
  --card: #ffffff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 28px -18px rgba(16, 24, 40, .35);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-700); }

img { max-width: 100%; display: block; }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 9px 16px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  background: #fff;
  color: var(--text);
  transition: .15s ease;
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--blue-600); color: #fff; box-shadow: 0 6px 16px -8px rgba(37, 99, 235, .8); }
.btn-primary:hover:not(:disabled) { background: var(--blue-700); }
.btn-outline { border-color: var(--line); color: var(--text); }
.btn-outline:hover:not(:disabled) { border-color: var(--blue-100); background: var(--blue-50); color: var(--blue-700); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--line-soft); color: var(--text); }
.btn-danger { background: var(--rose-600); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #be123c; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 14px 20px; font-size: 16px; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: none; color: var(--blue-600); padding: 0; cursor: pointer; font: inherit; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 16px; }
.field > label,
.label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.field .req { color: var(--rose-600); margin-left: 2px; }
.opt { font-weight: 400; color: var(--muted-2); font-size: 12px; margin-left: 4px; }

input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="submit"]):not([type="button"]),
select, textarea {
  width: 100%;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  outline: none;
  transition: .15s ease;
  appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.7; }
input:focus, select:focus, textarea:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
input:disabled, select:disabled, textarea:disabled { background: var(--line-soft); color: var(--muted); }
.input-sm { padding: 8px 10px; font-size: 13px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.row { display: flex; gap: 10px; align-items: center; }
.row-wrap { flex-wrap: wrap; }
.spacer { flex: 1; }

/* ---------------- 徽标 / 标签 ---------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--blue-50);
  color: var(--blue-700);
  border: 1px solid var(--blue-100);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  line-height: 1.6;
  white-space: nowrap;
}
.badge svg { width: 13px; height: 13px; }
.ic { width: 1.05em; height: 1.05em; flex: none; vertical-align: -0.14em; }
.btn .ic { width: 15px; height: 15px; }
.btn-sm .ic { width: 13px; height: 13px; }
.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 500;
}
.tag-sky { background: #e0f2fe; color: #0369a1; }
.tag-amber { background: var(--amber-50); color: var(--amber-700); }
.tag-emerald { background: var(--emerald-50); color: var(--emerald-700); }
.tag-rose { background: var(--rose-50); color: var(--rose-600); }
.tag-slate { background: var(--line-soft); color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 500; border-radius: 999px; padding: 2px 10px; }
.status-approved { background: var(--emerald-50); color: var(--emerald-700); }
.status-pending { background: var(--amber-50); color: var(--amber-700); }
.status-rejected { background: var(--rose-50); color: var(--rose-600); }
.status-hidden { background: var(--line-soft); color: var(--muted); }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 60;
  backdrop-filter: blur(2px);
}
.modal {
  background: #fff;
  border-radius: 18px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px -20px rgba(15, 23, 42, .5);
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 16px;
}
.modal-head .modal-close { margin-left: auto; }
.modal-body { padding: 18px 20px; overflow: auto; }
.modal-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.modal-close {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 8px;
}
.modal-close:hover { background: var(--line-soft); }
.modal-wide { max-width: 860px; }

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

/* ---------------- 资料详情（前台弹窗与后台弹窗共用） ---------------- */
.detail-hero { display: flex; gap: 14px; }
.detail-hero .gallery { width: 132px; flex: none; }
.gallery-main {
  width: 132px; height: 168px;
  border-radius: 14px; overflow: hidden; background: #eef2ff;
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; }
.gallery-thumbs img {
  width: 26px; height: 32px; border-radius: 6px; object-fit: cover;
  cursor: pointer; border: 2px solid transparent;
}
.gallery-thumbs img.active { border-color: var(--blue-500); }
.detail-name { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-code {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--blue-50); color: var(--blue-700);
  border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 600;
}
.detail-section { margin-top: 18px; }
.detail-section h4 { margin: 0 0 10px; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.detail-section h4 svg { width: 15px; height: 15px; color: var(--blue-600); }
.kv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
.kv { display: flex; font-size: 13px; gap: 8px; align-items: baseline; }
.kv .k { color: var(--muted); flex: none; }
.kv .v { color: var(--text); word-break: break-all; }
.detail-note {
  background: var(--line-soft);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  color: #4b5563;
  line-height: 1.75;
}
.detail-tip {
  margin-top: 14px;
  background: var(--amber-50);
  color: var(--amber-700);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
}
.thumb-list { display: flex; gap: 6px; flex-wrap: wrap; }
.thumb-list img { width: 62px; height: 78px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); cursor: pointer; }
#toast-wrap {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: rgba(15, 23, 42, .92);
  color: #fff;
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: pop .16s ease-out;
  max-width: 84vw;
}
.toast-ok { background: rgba(4, 120, 87, .95); }
.toast-err { background: rgba(190, 18, 60, .95); }

.empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.empty svg { width: 42px; height: 42px; color: var(--muted-2); margin: 0 auto 10px; }

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner-blue { border-color: var(--blue-100); border-top-color: var(--blue-600); }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-box { padding: 36px; display: flex; justify-content: center; }

/* ---------------- 图片查看器 ---------------- */
.gallery-main { position: relative; }
.gallery-main.zoomable { cursor: zoom-in; }
.photo-hint {
  position: absolute; right: 6px; bottom: 6px;
  background: rgba(15, 23, 42, .62); color: #fff; font-size: 11px;
  padding: 2px 7px; border-radius: 999px; pointer-events: none;
}
.photo-viewer {
  position: fixed; inset: 0; z-index: 4000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px; background: rgba(15, 23, 42, .93);
  animation: pvFade .18s ease;
}
@keyframes pvFade { from { opacity: 0 } to { opacity: 1 } }
.photo-viewer .pv-img {
  max-width: 94vw; max-height: 88vh; border-radius: 10px;
  object-fit: contain; background: #111827;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .5);
}
.photo-viewer .pv-close {
  position: absolute; top: 14px; right: 16px; width: 38px; height: 38px;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .16);
  color: #fff; font-size: 24px; line-height: 1; cursor: pointer;
}
.photo-viewer .pv-prev, .photo-viewer .pv-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 56px; border: 0; border-radius: 10px;
  background: rgba(255, 255, 255, .14); color: #fff;
  font-size: 30px; line-height: 1; cursor: pointer;
}
.photo-viewer .pv-prev { left: 10px; }
.photo-viewer .pv-next { right: 10px; }
.photo-viewer .pv-count {
  position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%);
  padding: 4px 12px; border-radius: 999px; font-size: 13px;
  color: #e5e7eb; background: rgba(0, 0, 0, .4);
}
