/* ==========================================================
   流浪猫TNR档案 · 样式
   移动端优先，暖色调
   ========================================================== */

:root {
  --bg: #fff7ef;
  --bg-2: #fdeee0;
  --card: #ffffff;
  --text: #3b2a24;
  --text-2: #7a6359;
  --muted: #b3a097;
  --line: #f1e3d6;
  --primary: #f0884a;
  --primary-2: #e5733a;
  --primary-soft: #fde6d6;
  --green: #4caf7d;
  --green-soft: #e3f5ea;
  --blue: #4a90d9;
  --blue-soft: #e4f0fb;
  --pink: #e86a92;
  --pink-soft: #fde7ee;
  --red: #e0533d;
  --red-soft: #fde8e4;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 6px 20px rgba(160, 100, 60, .08);
  --shadow-lg: 0 12px 34px rgba(160, 100, 60, .16);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary-2); text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
[hidden] { display: none !important; }

.icon { width: 1.25em; height: 1.25em; flex: none; vertical-align: -0.25em; }
.icon-lg { width: 34px; height: 34px; }
.muted { color: var(--muted); }
.warn { color: var(--red); }

.main {
  flex: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 14px 28px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 247, 239, .86);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(241, 227, 214, .7);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  max-width: 1120px;
  margin: 0 auto;
  height: 54px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-back {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-left: -8px;
  border-radius: 50%;
  color: var(--text);
}
.topbar-back:active { background: var(--bg-2); }
.topbar-back .icon { width: 24px; height: 24px; }
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
  min-width: 0;
}
.brand-logo {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f7a368, var(--primary-2));
  color: #fff;
  box-shadow: 0 4px 10px rgba(229, 115, 58, .3);
  flex: none;
}
.brand-logo .icon { width: 20px; height: 20px; }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-name small {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-left: 6px;
}

/* ---------- 首页 Hero ---------- */
.hero {
  position: relative;
  margin: 14px 0 6px;
  padding: 24px 20px 20px;
  border-radius: 24px;
  color: #fff;
  background:
    radial-gradient(circle at 92% 8%, rgba(255,255,255,.22) 0 60px, transparent 61px),
    radial-gradient(circle at 78% 100%, rgba(255,255,255,.12) 0 90px, transparent 91px),
    linear-gradient(135deg, #f6a46b 0%, #ee8146 55%, #e06a3a 100%);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.hero h1 { font-size: 24px; letter-spacing: .5px; }
.hero p { margin: 6px 0 0; opacity: .92; font-size: 14px; }
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 18px;
}
.stat {
  background: rgba(255,255,255,.18);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 14px;
  padding: 10px 6px;
  text-align: center;
}
.stat b { display: block; font-size: 22px; line-height: 1.2; }
.stat span { font-size: 12px; opacity: .9; }

/* ---------- 搜索与筛选 ---------- */
.toolbar {
  position: sticky;
  top: calc(54px + env(safe-area-inset-top, 0px));
  z-index: 20;
  background: var(--bg);
  padding: 12px 0 10px;
  margin: 0 -14px;
  padding-left: 14px;
  padding-right: 14px;
}
.search {
  position: relative;
  display: flex;
  align-items: center;
}
.search .icon {
  position: absolute;
  left: 14px;
  color: var(--muted);
  pointer-events: none;
}
.search input {
  width: 100%;
  height: 44px;
  padding: 0 16px 0 42px;
  border: 1.5px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  outline: none;
  font-size: 15px;
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
}
.search input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.chips {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 6px 16px;
  border-radius: 20px;
  background: var(--card);
  color: var(--text-2);
  font-size: 14px;
  border: 1.5px solid var(--line);
  transition: all .2s;
}
.chip.active { background: var(--text); border-color: var(--text); color: #fff; }
.result-hint { margin: 2px 2px 10px; font-size: 13px; color: var(--text-2); }

/* ---------- 猫咪卡片 ---------- */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.cat-card {
  display: block;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  color: var(--text);
  transition: transform .2s, box-shadow .2s;
}
.cat-card:active { transform: scale(.97); }
@media (hover: hover) {
  .cat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
  .cat-card:hover img { transform: scale(1.05); }
}
.cat-card-img {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg-2);
  overflow: hidden;
}
.cat-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s;
}
.cat-code {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 2px 9px;
  border-radius: 10px;
  background: rgba(59, 42, 36, .62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .3px;
  max-width: calc(100% - 16px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cat-card-body { padding: 10px 12px 12px; }
.cat-name {
  display: block;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 空状态 / 分页 ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty-icon {
  width: 76px;
  height: 76px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
}
.empty-icon .icon { width: 38px; height: 38px; }
.empty p { margin: 0 0 18px; }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 26px 0 6px;
}
.pager-btn {
  padding: 8px 18px;
  border-radius: 20px;
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 14px;
}
.pager-btn.disabled { opacity: .4; box-shadow: none; }
.pager-info { color: var(--text-2); font-size: 14px; }

/* ---------- 页脚 ---------- */
.footer {
  text-align: center;
  padding: 26px 16px calc(26px + var(--safe-b));
  color: var(--text-2);
  font-size: 13px;
  border-top: 1px solid var(--line);
  background: var(--bg-2);
}
.footer p { margin: 6px 0 0; }
.footer-tnr {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}
.footer-tnr b { color: var(--primary-2); font-size: 15px; }
.footer-tnr i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); }
.footer-small { font-size: 12px; color: var(--muted); }
.footer-small a { color: var(--muted); text-decoration: underline; }

/* ==========================================================
   详情页
   ========================================================== */
.page-detail .main { padding-left: 0; padding-right: 0; }
.detail-media { position: relative; }
.gallery {
  position: relative;
  background: var(--bg-2);
  overflow: hidden;
}
.gallery-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-slide {
  flex: 0 0 100%;
  margin: 0;
  scroll-snap-align: center;
  aspect-ratio: 1 / 1;
  cursor: zoom-in;
}
.gallery-slide img, .gallery-empty img { width: 100%; height: 100%; object-fit: cover; }
.gallery-empty { aspect-ratio: 1 / 1; }
.gallery-count {
  position: absolute;
  right: 12px;
  top: 12px;
  padding: 2px 10px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .45);
  color: #fff;
  font-size: 12px;
}
.gallery-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 34px;
  display: flex;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
}
.gallery-dots i {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,.6);
  transition: all .25s;
}
.gallery-dots i.active { width: 18px; background: #fff; }
.gallery-thumbs { display: none; }

.detail-info {
  position: relative;
  margin-top: -22px;
  padding: 0 14px;
  border-radius: 24px 24px 0 0;
  background: var(--bg);
}
.profile { padding: 20px 4px 14px; }
.profile-top { display: flex; align-items: center; gap: 10px; }
.profile h1 { font-size: 26px; word-break: break-all; }
.gender-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 17px;
  font-weight: 700;
  background: var(--bg-2);
  color: var(--text-2);
}
.gender-badge.is-male { background: var(--blue-soft); color: var(--blue); }
.gender-badge.is-female { background: var(--pink-soft); color: var(--pink); }
.profile-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg-2);
  color: var(--text-2);
  white-space: nowrap;
}
.tag-code { background: var(--primary-soft); color: var(--primary-2); }
.tag-ok { background: var(--green-soft); color: var(--green); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  margin-bottom: 12px;
}
.card-title .icon { color: var(--primary); }

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 0;
}
.info-grid > div {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-width: 0;
}
.info-grid dt { font-size: 12px; color: var(--text-2); }
.info-grid dd { margin: 2px 0 0; font-weight: 600; word-break: break-all; }
.vac-yes { color: var(--green); }
.vac-no { color: var(--red); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  position: relative;
  display: flex;
  gap: 12px;
  padding-bottom: 18px;
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 38px;
  bottom: 2px;
  width: 2px;
  background: var(--line);
}
.timeline li.done:not(:last-child)::before { background: linear-gradient(var(--primary), var(--primary-soft)); }
.tl-dot {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-2);
  color: var(--muted);
}
.tl-dot .icon { width: 18px; height: 18px; }
.timeline li.done .tl-dot { background: var(--primary); color: #fff; box-shadow: 0 4px 10px rgba(240,136,74,.35); }
.tl-body { flex: 1; min-width: 0; padding-top: 6px; }
.tl-body h3 { font-size: 15px; margin-bottom: 4px; }
.tl-body h3 small { font-weight: 500; color: var(--muted); font-size: 12px; margin-left: 4px; }
.tl-body p { margin: 2px 0; font-size: 14px; word-break: break-all; }
.tl-k { display: inline-block; width: 40px; color: var(--text-2); font-size: 13px; }
.tl-days {
  display: inline-block;
  margin-top: 6px !important;
  padding: 2px 10px;
  border-radius: 10px;
  background: var(--primary-soft);
  color: var(--primary-2);
  font-size: 13px !important;
}

.remark { white-space: normal; word-break: break-word; color: var(--text); }
.detail-meta { text-align: center; color: var(--muted); font-size: 12px; margin: 6px 0 0; }

/* ---------- 灯箱 ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 10, 8, .96);
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: fadein .2s;
}
@keyframes fadein { from { opacity: 0; } }
.lightbox-track {
  display: flex;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.lightbox-track::-webkit-scrollbar { display: none; }
.lightbox-track figure {
  flex: 0 0 100%;
  margin: 0;
  display: grid;
  place-items: center;
  scroll-snap-align: center;
  padding: 50px 0;
}
.lightbox-track img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-close {
  position: absolute;
  right: 12px;
  top: calc(12px + env(safe-area-inset-top, 0px));
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.14);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.lightbox-count {
  position: absolute;
  bottom: calc(18px + var(--safe-b));
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255,255,255,.75);
  font-size: 14px;
}
body.no-scroll { overflow: hidden; }

/* ==========================================================
   后台
   ========================================================== */
.admin-nav { margin-left: auto; display: flex; gap: 2px; }
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 10px;
  color: var(--text-2);
  font-size: 14px;
}
.admin-nav a.active { background: var(--primary-soft); color: var(--primary-2); }
.admin-nav a:active { background: var(--bg-2); }
.is-admin .main { padding-bottom: calc(90px + var(--safe-b)); }

.admin-page { padding-top: 18px; }
.admin-page.narrow { max-width: 720px; margin: 0 auto; }
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.page-title { font-size: 22px; }
.page-title small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.admin-page > .search { margin-bottom: 14px; }

.admin-list { display: flex; flex-direction: column; gap: 10px; }
.admin-item {
  display: flex;
  align-items: center;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
  gap: 6px;
}
.admin-item-main { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; color: var(--text); }
.admin-thumb {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  object-fit: cover;
  background: var(--bg-2);
  flex: none;
}
.admin-item-text { min-width: 0; }
.admin-item-title { display: flex; align-items: center; gap: 8px; }
.admin-item-title b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-item-sub { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-item-sub.muted { color: var(--muted); font-size: 12px; }
.admin-item-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.admin-item-actions form { margin: 0; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.icon-btn:hover, .icon-btn:active { background: var(--bg-2); }
.icon-btn.danger:hover, .icon-btn.danger:active { background: var(--red-soft); color: var(--red); }

.fab {
  position: fixed;
  right: 18px;
  bottom: calc(22px + var(--safe-b));
  z-index: 40;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #f7a368, var(--primary-2));
  box-shadow: 0 10px 24px rgba(229, 115, 58, .45);
}
.fab .icon { width: 28px; height: 28px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 22px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .1s, box-shadow .2s, background .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #f59a5f, var(--primary-2));
  box-shadow: 0 6px 16px rgba(229, 115, 58, .32);
}
.btn-ghost { background: var(--card); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-danger-ghost { background: transparent; color: var(--red); }
.btn-danger-ghost:hover { background: var(--red-soft); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; pointer-events: none; }

/* ---------- 表单 ---------- */
.form .card { padding: 18px 16px; }
.field { display: block; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field > span, .field-group-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}
.field-group-label small { font-weight: 500; margin-left: 6px; }
.req { color: var(--red); font-style: normal; }
.field input:not([type=radio]):not([type=file]), .field textarea, .field select {
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fffdfb;
  outline: none;
  font-size: 16px; /* 16px 防止 iOS 聚焦时自动放大 */
  transition: border-color .2s, box-shadow .2s;
  -webkit-appearance: none;
  appearance: none;
}
.field input[type=date] { display: block; line-height: 24px; }
.field textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
.field input:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); background: #fff; }
.has-error input { border-color: var(--red) !important; }
.field-error { display: block; color: var(--red); font-size: 13px; font-style: normal; margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
.form-grid .field:last-child { margin-bottom: 14px; }
.card > .form-grid:last-child .field:last-child { margin-bottom: 0; }

.segmented {
  display: flex;
  padding: 4px;
  border-radius: 14px;
  background: var(--bg-2);
  gap: 4px;
}
.segmented label { flex: 1; position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block;
  text-align: center;
  padding: 9px 4px;
  border-radius: 10px;
  font-size: 15px;
  color: var(--text-2);
  cursor: pointer;
  transition: all .2s;
}
.segmented input:checked + span { background: #fff; color: var(--primary-2); font-weight: 700; box-shadow: 0 2px 8px rgba(160,100,60,.15); }
.segmented input:focus-visible + span { outline: 2px solid var(--primary); }

/* 照片上传 */
.upload-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 22px 14px;
  border: 2px dashed #efcfb6;
  border-radius: var(--radius);
  background: #fffaf5;
  color: var(--text-2);
  text-align: center;
  cursor: pointer;
  transition: background .2s, border-color .2s;
}
.upload-drop:hover, .upload-drop.dragover { background: var(--primary-soft); border-color: var(--primary); }
.upload-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-drop .icon { color: var(--primary); }
.upload-drop b { color: var(--text); }
.upload-drop small { color: var(--muted); font-size: 12px; }

.photo-manage, .upload-preview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.photo-manage { margin-bottom: 12px; }
.upload-preview:not(:empty) { margin-top: 12px; }
.photo-item, .preview-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-2);
}
.photo-item img, .preview-item img { width: 100%; height: 100%; object-fit: cover; }
.photo-cover-badge {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 1px 8px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.photo-act {
  position: absolute;
  left: 6px;
  top: 6px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.45);
  color: #fff;
  cursor: pointer;
}
.photo-act .icon { width: 17px; height: 17px; }
.photo-act.photo-del { left: auto; right: 6px; }
.photo-act:hover { background: var(--primary); }
.photo-act.photo-del:hover { background: var(--red); }
.preview-item span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2px 6px;
  font-size: 11px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.55));
  text-align: center;
}
.preview-item button {
  position: absolute;
  right: 6px;
  top: 6px;
}

.save-bar {
  position: sticky;
  bottom: 0;
  z-index: 30;
  display: flex;
  flex-direction: row-reverse;
  gap: 10px;
  margin: 0 -14px;
  padding: 12px 14px calc(12px + var(--safe-b));
  background: rgba(255, 247, 239, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.save-bar .btn { flex: 1; }
.danger-zone { text-align: center; margin-top: 18px; }

/* ---------- 提示消息 ---------- */
.flashes { padding-top: 14px; }
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-size: 14px;
  animation: slidein .3s;
}
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } }
.flash-success { background: var(--green-soft); color: #2e7d55; }
.flash-error { background: var(--red-soft); color: #b13a28; }

/* ---------- 登录页 ---------- */
.page-auth {
  background:
    radial-gradient(circle at 10% 0%, #fde0c8 0, transparent 40%),
    radial-gradient(circle at 100% 100%, #fbd5bd 0, transparent 45%),
    var(--bg);
}
.page-auth .main { display: flex; align-items: center; justify-content: center; padding-top: 30px; }
.auth-box {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 30px 22px 22px;
  text-align: center;
}
.auth-box .form { text-align: left; margin-top: 18px; }
.auth-box .btn { margin-top: 6px; }
.auth-logo {
  width: 62px;
  height: 62px;
  margin: 0 auto 12px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, #f7a368, var(--primary-2));
  box-shadow: 0 8px 20px rgba(229, 115, 58, .35);
}
.auth-logo .icon { width: 34px; height: 34px; }
.auth-box h1 { font-size: 21px; }
.auth-sub { color: var(--text-2); margin: 4px 0 0; font-size: 14px; }
.auth-box .flash { margin-top: 16px; text-align: left; }
.auth-link { display: inline-block; margin-top: 16px; font-size: 14px; color: var(--text-2); }

/* ---------- 响应式 ---------- */
.show-mobile { display: grid; }
.hide-mobile { display: none; }

@media (max-width: 600px) {
  .admin-nav a span { display: none; }
  .admin-nav a { padding: 8px; }
  .admin-nav a .icon { width: 22px; height: 22px; }
  .is-admin .brand-name small { display: none; }
}
@media (max-width: 440px) {
  .is-admin .topbar-back + .brand .brand-name { display: none; }
}
@media (max-width: 380px) {
  .admin-item-actions .icon-btn:first-child { display: none; }
}

@media (min-width: 600px) {
  .main { padding: 0 24px 40px; }
  .topbar-inner { padding: 0 24px; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .photo-manage, .upload-preview { grid-template-columns: repeat(4, 1fr); }
  .hero { padding: 34px 32px 28px; }
  .hero h1 { font-size: 30px; }
  .toolbar { margin: 0 -24px; padding-left: 24px; padding-right: 24px; display: flex; align-items: center; gap: 14px; }
  .toolbar .search { flex: 1; max-width: 420px; }
  .toolbar .chips { margin-top: 0; }
  .save-bar { margin: 0; border-radius: var(--radius); border: 1px solid var(--line); bottom: 14px; }
  .save-bar .btn { flex: none; min-width: 140px; }
  .show-mobile { display: none; }
  .hide-mobile { display: inline-flex; }
  .info-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 900px) {
  .cat-grid { grid-template-columns: repeat(4, 1fr); }
  .hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; }
  .stats { margin-top: 0; min-width: 380px; }

  .page-detail .main { padding: 24px 24px 40px; }
  .detail {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 32px;
    align-items: start;
  }
  .detail-media { position: sticky; top: 78px; }
  .gallery { border-radius: 24px; box-shadow: var(--shadow-lg); }
  .gallery-dots { bottom: 14px; }
  .gallery-thumbs { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
  .gallery-thumbs button {
    width: 68px;
    height: 68px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: var(--bg-2);
    opacity: .65;
    transition: all .2s;
  }
  .gallery-thumbs button.active { border-color: var(--primary); opacity: 1; }
  .gallery-thumbs img { width: 100%; height: 100%; object-fit: cover; }
  .detail-info { margin-top: 0; padding: 0; background: none; }
  .profile { padding-top: 4px; }
  .profile h1 { font-size: 32px; }
  .info-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1100px) {
  .cat-grid { grid-template-columns: repeat(5, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
