/* =========================================================
   我的画廊 · 管理后台样式
   ========================================================= */

:root {
  --serif: "Playfair Display", "Noto Serif SC", "Songti SC", "STSong", "SimSun", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Helvetica, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --bg: #f4f5f6;
  --card: #ffffff;
  --ink: #1d1e21;
  --muted: #6f747b;
  --line: rgba(20, 20, 24, 0.09);
  --line-strong: rgba(20, 20, 24, 0.16);
  --pink: #fbeaeb;
  --pink-deep: #f6dcde;
  --accent: #a84851;
  --accent-ink: #ffffff;
  --danger: #a92f27;
  --ok: #2f7d55;
  --warn: #9a6a12;
  --radius: 16px;
  --shadow: 0 16px 40px rgba(20, 22, 28, 0.06);
  /* 下面这些把原先散落的硬编码色收成变量，深色模式只需整组覆盖 */
  --surface: #fdfdfd;
  --field: #ffffff;
  --surface-2: #fbfbfc;
  --surface-3: #f6f6f7;
  --surface-4: #f7f8f9;
  --track: #eceef0;
  --hover: rgba(20, 20, 24, 0.05);
  --hover-2: rgba(20, 20, 24, 0.07);
  --hover-3: rgba(20, 20, 24, 0.06);
  --hover-4: rgba(20, 20, 24, 0.08);
  --line-soft: rgba(20, 20, 24, 0.04);
  --veil: rgba(255, 255, 255, 0.92);
  --scrim: rgba(20, 20, 24, 0.62);
  --mask: rgba(0, 0, 0, 0.45);
  --mask-ink: rgba(255, 255, 255, 0.9);
  --modal-mask: rgba(16, 17, 19, 0.45);
  --shadow-card: 0 12px 28px rgba(20, 22, 28, 0.08);
  --shadow-pop: 0 30px 70px rgba(20, 22, 28, 0.1);
  --shadow-modal: 0 30px 80px rgba(0, 0, 0, 0.25);
  --ok-bg: #edf7f1;
  --ok-bg-2: #e7f4ec;
  --ok-line: #cfe9db;
  --err-bg: #fcefee;
  --err-bg-2: #fbeceb;
  --err-line: #f2d3d0;
  --info-bg: #eef4fb;
  --info-line: #d7e5f5;
  --info-ink: #2b5f95;
  --warn-bg: #fdf6e7;
  --warn-bg-2: #fdf1da;
  --warn-line: #f1e2bf;
  --accent-deep: #963d46;
  --hero-tint: #f3e9e4;
  --checker: rgba(0, 0, 0, 0.07);
}

/* ============ 深色模式：整组覆盖上面的 token ============ */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #17181b;
  --card: #1f2125;
  --ink: #eceef1;
  --muted: #9ba1a9;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.18);
  --pink: #33262a;
  --pink-deep: #3f2c31;
  --accent: #c96a74;
  --accent-ink: #17181b;
  --danger: #e0736a;
  --ok: #6cbb90;
  --warn: #d9ad55;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  --surface: #24272c;
  --field: #24272c;
  --surface-2: #232629;
  --surface-3: #26292e;
  --surface-4: #22252a;
  --track: #313539;
  --hover: rgba(255, 255, 255, 0.06);
  --hover-2: rgba(255, 255, 255, 0.09);
  --hover-3: rgba(255, 255, 255, 0.07);
  --hover-4: rgba(255, 255, 255, 0.10);
  --line-soft: rgba(255, 255, 255, 0.05);
  --veil: rgba(23, 24, 27, 0.92);
  --scrim: rgba(0, 0, 0, 0.66);
  --mask: rgba(0, 0, 0, 0.60);
  --mask-ink: rgba(255, 255, 255, 0.88);
  --modal-mask: rgba(0, 0, 0, 0.62);
  --shadow-card: 0 12px 28px rgba(0, 0, 0, 0.45);
  --shadow-pop: 0 30px 70px rgba(0, 0, 0, 0.55);
  --shadow-modal: 0 30px 80px rgba(0, 0, 0, 0.6);
  --ok-bg: #1d2c25;
  --ok-bg-2: #20332a;
  --ok-line: #2d4c3c;
  --err-bg: #2e2023;
  --err-bg-2: #33252a;
  --err-line: #4e3035;
  --info-bg: #1d2836;
  --info-line: #2c3e56;
  --info-ink: #93bbea;
  --warn-bg: #2d2718;
  --warn-bg-2: #332c1c;
  --warn-line: #4e4327;
  --accent-deep: #b8515c;
  --hero-tint: #241f22;
  --checker: rgba(255, 255, 255, 0.08);
}

/* 深色下照片占位与缩略图需要一点亮度，避免整块死黑 */
html[data-theme="dark"] .trash-missing {
  filter: brightness(1.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
}

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

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 顶栏 ---------- */

.admin-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--veil);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.admin-header-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px;
  height: 66px;
  display: flex;
  align-items: center;
  gap: 26px;
}

.admin-brand {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  flex: none;
}

.admin-brand-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.admin-brand-sub {
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.admin-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  transition: background-color 0.2s, color 0.2s;
}

.tab:hover {
  background: var(--hover);
  color: var(--ink);
}

.tab.is-active {
  background: var(--pink);
  color: var(--accent);
}

.tab-count {
  font-size: 10.5px;
  background: var(--hover-2);
  border-radius: 999px;
  padding: 1px 7px;
  color: inherit;
}

.tab.is-active .tab-count {
  background: rgba(168, 72, 81, 0.12);
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

.user-site-link {
  font-size: 12px;
  color: var(--muted);
  border-bottom: 1px solid transparent;
}

.user-site-link:hover {
  color: var(--ink);
  border-color: currentColor;
}

.user-name {
  font-size: 12.5px;
  color: var(--muted);
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

/* ---------- 布局 ---------- */

.admin-main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px 24px 48px;
}

.admin-footer {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 24px 40px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: 11.5px;
  color: var(--muted);
}

.admin-footer a:hover {
  color: var(--ink);
}

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

.alert {
  margin-bottom: 16px;
  padding: 11px 16px;
  border-radius: 12px;
  font-size: 13px;
  border: 1px solid transparent;
}

.alert-ok {
  background: var(--ok-bg);
  border-color: var(--ok-line);
  color: var(--ok);
}

.alert-error {
  background: var(--err-bg);
  border-color: var(--err-line);
  color: var(--danger);
}

.alert-info {
  background: var(--info-bg);
  border-color: var(--info-line);
  color: var(--info-ink);
}

.alert-warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--warn);
}

/* ---------- 统计 ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.stat-value {
  font-family: var(--serif);
  font-size: 22px;
  line-height: 1.2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.stat-env {
  grid-column: span 1;
}

.stat-env .stat-value {
  font-family: var(--sans);
  font-size: 12px;
}

.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  background: var(--hover-3);
}

.chip-ok {
  background: var(--ok-bg-2);
  color: var(--ok);
}

.chip-warn {
  background: var(--warn-bg-2);
  color: var(--warn);
}

/* ---------- 卡片 ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card-head {
  margin-bottom: 18px;
}

.card-head h2 {
  margin: 0 0 4px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 0.02em;
}

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

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.list-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---------- 上传 ---------- */

.upload-zone {
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  padding: 30px 20px;
  text-align: center;
  background: var(--surface-2);
  transition: border-color 0.25s, background-color 0.25s;
  cursor: pointer;
}

.upload-zone:hover,
.upload-zone.is-drag {
  border-color: var(--accent);
  background: var(--pink);
}

.upload-plus {
  width: 42px;
  height: 42px;
  margin: 0 auto 10px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 300;
  color: var(--accent);
  background: var(--field);
}

.upload-main {
  margin: 0 0 6px;
  font-size: 14px;
}

.upload-link {
  color: var(--accent);
  border-bottom: 1px solid currentColor;
}

.upload-hint {
  margin: 0;
  font-size: 11.5px;
  color: var(--muted);
}

.progress {
  position: relative;
  margin: 16px auto 0;
  max-width: 520px;
  height: 6px;
  border-radius: 999px;
  background: var(--hover-4);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  border-radius: inherit;
  transition: width 0.15s linear;
}

.progress-text {
  display: block;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
}

.upload-result {
  list-style: none;
  margin: 14px auto 0;
  padding: 0;
  max-width: 640px;
  text-align: left;
  font-size: 12px;
}

.upload-result li {
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--line-soft);
  margin-bottom: 6px;
  color: var(--muted);
}

.upload-result li.is-error {
  background: var(--err-bg-2);
  color: var(--danger);
}

/* ---------- 照片列表 ---------- */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.photo-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.photo-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-card);
}

.photo-card.is-hidden-photo {
  opacity: 0.72;
}

.photo-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--track);
  overflow: hidden;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.badge {
  font-size: 10px;
  line-height: 1;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--scrim);
  color: #fff;
  letter-spacing: 0.06em;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.badge-muted {
  background: rgba(168, 72, 81, 0.82);
}

.badge-external {
  background: rgba(46, 92, 128, 0.86);
}

.thumb-index {
  position: absolute;
  right: 8px;
  bottom: 8px;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--mask);
  color: var(--mask-ink);
}

.photo-info {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.photo-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.photo-meta {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.photo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.btn:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
}

.btn-small {
  padding: 5px 10px;
  font-size: 12px;
  border-radius: 7px;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--hover);
  border-color: transparent;
}

.btn-danger-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--danger);
}

.btn-danger-ghost:hover {
  background: var(--err-bg-2);
  border-color: transparent;
}

.btn-block {
  width: 100%;
}

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

.pager-bottom {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 20px;}

.pager-info {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- 空状态 ---------- */

.empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--muted);
  font-family: var(--serif);
  font-size: 18px;
}

/* ---------- 编辑弹窗 ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--modal-mask);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal-card {
  position: relative;
  width: min(760px, 100%);
  max-height: min(90vh, 900px);
  overflow-y: auto;
  background: var(--card);
  border-radius: 18px;
  padding: 26px 26px 22px;
  box-shadow: var(--shadow-modal);
  animation: modal-in 0.25s ease;
}

@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-card h2 {
  margin: 0 0 14px;
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--muted);
}

.modal-close:hover {
  background: var(--hover-3);
  color: var(--ink);
}

.edit-preview {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px;
  margin-bottom: 16px;
  background: var(--surface-4);
  border-radius: 12px;
}

.edit-preview img {
  width: 96px;
  height: 72px;
  object-fit: cover;
  border-radius: 8px;
  background: #e7e9ec;
}

/* ---------- 表单 ---------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 13px;
}

.field-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(168, 72, 81, 0.12);
}

.textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.75;
}

.select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}

.form-row-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
  margin: 4px 0 16px;
}

.check input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

/* 紧跟在勾选项后面的说明：另起一行并与勾选文字对齐 */
.check + .hint {
  display: block;
  margin: -10px 0 16px 23px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

/* ---------- 回收站 ---------- */

.trash-list {
  display: grid;
  gap: 12px;
}

.trash-item {
  display: flex;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.trash-thumb {
  position: relative;
  width: 110px;
  height: 82px;
  flex: none;
  border-radius: 8px;
  overflow: hidden;
  background: var(--track);
}
.trash-thumb .badge {
  position: absolute;
  top: 6px;
  left: 6px;
}
.trash-missing {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted, #8a8f98);
}

.trash-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.trash-info h3 {
  margin: 2px 0 2px;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 600;
}

/* ---------- 两栏 / 信息列表 ---------- */

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.two-col .card {
  margin-bottom: 0;
}

.info-dl {
  display: grid;
  grid-template-columns: minmax(90px, auto) 1fr;
  gap: 0;
  margin: 0 0 16px;
  font-size: 13px;
}

.info-dl dt {
  padding: 8px 0;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.info-dl dd {
  margin: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  text-align: right;
  word-break: break-word;
}

.info-dl dd a {
  color: var(--accent);
}

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

.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 600px at 10% -10%, #fbeaeb 0%, rgba(251, 234, 235, 0) 60%),
    radial-gradient(900px 500px at 100% 100%, var(--hero-tint) 0%, transparent 55%),
    var(--bg);
}

.login-wrap {
  width: 100%;
  max-width: 400px;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 34px 30px 26px;
  box-shadow: var(--shadow-pop);
}

.login-brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 26px;
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 600;
}

.login-brand-sub {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.login-title {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 500;
}

.login-form .field {
  margin-bottom: 15px;
}

.login-form .btn {
  margin-top: 6px;
  padding: 11px 16px;
}

/* 极验人机验证提示区（脚本来源、加载状态都写在这里） */
.gt-box {
  margin: 2px 0 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-3);
}

.gt-tip {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.gt-tip a {
  color: var(--accent);
  text-decoration: underline;
}

.gt-tip-warn {
  margin: 0 0 12px;
  color: var(--danger);
  font-size: 12.5px;
}

.login-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  font-size: 12px;
  color: var(--muted);
}

.login-foot a:hover {
  color: var(--ink);
}

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

@media (max-width: 1100px) {
  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .admin-header-inner {
    height: auto;
    min-height: 62px;
    flex-wrap: wrap;
    gap: 10px 16px;
    padding: 10px 16px;
  }

  .admin-tabs {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .admin-user {
    margin-left: auto;
  }

  .admin-main {
    padding: 18px 16px 40px;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-row,
  .form-row-3 {
    grid-template-columns: 1fr;
  }

  .admin-footer {
    padding: 0 16px 30px;
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 560px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 16px;
  }

  .trash-item {
    flex-direction: column;
  }

  .trash-thumb {
    width: 100%;
    height: 150px;
  }

  .modal-card {
    padding: 20px 16px 16px;
  }

  .edit-preview {
    flex-direction: column;
    align-items: flex-start;
  }

  .edit-preview img {
    width: 100%;
    height: 140px;
  }

  .user-site-link {
    display: none;
  }
}

/* 照片列表的搜索与筛选条 */
.list-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  padding-bottom: 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 116px;
}

.filter-search {
  flex: 1 1 240px;
  min-width: 190px;
}

.filter-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.filter-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-filter .input {
  width: 100%;
}

.empty a {
  color: inherit;
  text-decoration: underline;
}

/* 关于页素材：预览 + 地址 + 上传 + 清除，竖着排在一格内 */
.asset-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.asset-preview {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: var(--panel-2, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--line);
  font-size: 11px;
  color: var(--ink-3, #8a8a90);
}

.asset-preview.asset-qr {
  width: 88px;
  height: 88px;
  border-radius: 10px;
}

.asset-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.asset-preview em {
  font-style: normal;
}

.input.file {
  padding: 7px 9px;
  font-size: 12px;
}
/* ---------- 友情链接设置行 ---------- */
.coord-row {
  display: flex;
  gap: 8px;
}

.link-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0 4px;
}

.link-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

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

.link-row-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-row-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
}

.asset-preview.asset-link-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 9px;
}

.asset-preview.asset-link-icon img {
  object-fit: contain;
}

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

@media (max-width: 760px) {
  .link-row-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}


.check-inline {
  margin: 2px 0 0;
}

/* 签名图预览：横向留白 + 棋盘底，透明 PNG 能看清边缘 */
.asset-preview.asset-sign {
  width: 100%;
  max-width: 220px;
  height: 64px;
  border-radius: 8px;
  background-image:
    linear-gradient(45deg, var(--checker) 25%, transparent 25%, transparent 75%, rgba(0, 0, 0, 0.07) 75%),
    linear-gradient(45deg, var(--checker) 25%, transparent 25%, transparent 75%, rgba(0, 0, 0, 0.07) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 6px 6px;
}

.asset-preview.asset-sign img {
  width: auto;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
}

.theme-toggle {
  white-space: nowrap;
}

.login-theme {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 6;
}

/* =========================================================
   v1.31.0 追加层：图标系统、无障碍辅助、排版微调、移动端适配
   放在文件末尾，同优先级下覆盖上面的旧规则；旧的 @media 段保留作
   中间尺寸（761–900px）的兜底。
   ========================================================= */

/* ---------- 图标：sprite 由 lib/icons.php 内联，描边走 currentColor ---------- */

.icon {
  width: 1em;
  height: 1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -0.15em;
}

.btn .icon { font-size: 15px; }
.btn-small .icon { font-size: 14px; }
.tab .tab-icon { font-size: 15px; }
.icon-btn { width: 34px; padding-left: 0; padding-right: 0; }
.icon-btn .icon { font-size: 16px; }

/* ---------- 无障碍辅助 ---------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: 14px;
  z-index: 90;
  padding: 10px 16px;
  border-radius: 0 0 12px 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  transition: top 0.18s ease;
}

.skip-link:focus {
  top: 0;
}

#adminMain:focus,
#adminMain:focus-visible {
  outline: none;
}

/* 只在需要的宽度下出现的文案（上传区：桌面说"拖拽"，手机只说"点击"） */
.only-mobile {
  display: none;
}

/* ---------- 顶栏 ---------- */

.admin-brand {
  align-items: center;
  gap: 10px;
}

.admin-brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--pink);
  color: var(--accent);
}

.admin-brand-mark .icon {
  width: 17px;
  height: 17px;
}

.admin-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.user-name,
.user-site-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.user-site-link .icon,
.user-name .icon {
  font-size: 14px;
  opacity: 0.8;
}

/* ---------- 提示条 / 统计 / 卡片头 ---------- */

.alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.alert-icon {
  font-size: 16px;
  margin-top: 1px;
}

.alert-text {
  flex: 1;
  min-width: 0;
}

.stats {
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
}

.stat {
  position: relative;
  padding-top: 16px;
}

.stat-icon {
  position: absolute;
  top: 13px;
  right: 14px;
  color: var(--accent);
  opacity: 0.5;
}

.stat-icon .icon {
  width: 17px;
  height: 17px;
}

.card {
  padding: 24px;
}

.card-head {
  margin-bottom: 20px;
}

.card-head h2,
.modal-card h2 {
  display: flex;
  align-items: center;
  gap: 9px;
}

.h2-icon {
  color: var(--accent);
  font-size: 19px;
}

.hint {
  max-width: 92ch;
}

/* ---------- 上传区 ---------- */

.upload-plus {
  width: 46px;
  height: 46px;
  font-size: 22px;
  color: var(--accent);
}

.upload-plus .icon {
  width: 21px;
  height: 21px;
}

.upload-zone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- 筛选条 / 列表 ---------- */

.filter-label {
  display: flex;
  align-items: center;
  gap: 5px;
}

.filter-icon {
  font-size: 12px;
  opacity: 0.85;
}

.photo-actions {
  gap: 6px;
}

.pager-info {
  font-variant-numeric: tabular-nums;
}

.empty-icon {
  display: block;
  margin: 0 auto 12px;
  color: var(--muted);
  opacity: 0.55;
}

.empty-icon .icon {
  width: 36px;
  height: 36px;
  stroke-width: 1.4;
}

/* ---------- 弹窗 / 页脚 / 登录页 ---------- */

.modal-close {
  display: grid;
  place-items: center;
}

.modal-close .icon {
  width: 18px;
  height: 18px;
}

.admin-footer-brand,
.admin-footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.admin-footer-links a .icon {
  font-size: 13px;
}

.foot-dot {
  opacity: 0.5;
  margin: 0 6px;
}

.login-locked {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--warn);
}

/* 倒计时解锁后由 JS 给徽标加 hidden；它是 inline-flex，会盖掉 UA 的 [hidden] 规则，必须自己补 */
.login-locked[hidden] {
  display: none;
}

/* 实时倒计时的秒数：等宽数字，递减时不跳宽 */
.count-num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ---------- 平板与手机：≤900px 把主导航换成底部标签条 ---------- */

@media (max-width: 900px) {
  /* 顶栏的 backdrop-filter 会让它成为 fixed 子元素的包含块，
     底部导航条要贴着视口，所以窄屏下先摘掉毛玻璃 */
  .admin-header {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: var(--card);
  }

  .admin-header-inner {
    height: 56px;
    min-height: 56px;
    padding: 0 18px;
    gap: 10px;
    flex-wrap: nowrap;
  }

  .admin-brand {
    flex: 1 1 auto;
    min-width: 0;
  }

  .admin-brand-text {
    min-width: 0;
  }

  .admin-brand-title {
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .admin-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    order: 0;
    flex: none;
    width: auto;
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    overflow: visible;
    background: var(--card);
    border-top: 1px solid var(--line);
    border-bottom: 0;
    z-index: 46;
  }

  /* 平板宽度：图标 + 文字横排的胶囊 dock，比四宫格省一半高度 */
  .tab {
    flex: 0 1 auto;
    flex-direction: row;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 999px;
    font-size: 13px;
  }

  .tab .tab-icon {
    font-size: 17px;
  }

  .tab-count {
    font-size: 10.5px;
    padding: 1px 7px;
  }

  .admin-user {
    gap: 4px;
    margin-left: 0;
  }

  body {
    padding-bottom: calc(66px + env(safe-area-inset-bottom));
  }

  .admin-footer {
    padding-bottom: 24px;
  }
}

/* ---------- 手机：≤760px ---------- */

@media (max-width: 760px) {
  .admin-header-inner {
    padding: 0 14px;
  }

  .admin-brand-sub {
    display: none;
  }

  body {
    padding-bottom: calc(78px + env(safe-area-inset-bottom));
  }

  .admin-tabs {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 2px;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }

  .tab {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 7px 2px 23px;
    border-radius: 12px;
    font-size: 11px;
    line-height: 1.25;
    /* 角标改成绝对定位，所以这里给五个标签一律留出那一行的高度，
       有数字的（照片 / 回收站）和没数字的图标与文字才在同一条基线上 */
    position: relative;
  }

  .tab .tab-icon {
    font-size: 19px;
  }

  .tab-count {
    position: absolute;
    left: 50%;
    bottom: 6px;
    transform: translateX(-50%);
    font-size: 9.5px;
    line-height: 1.5;
    padding: 0 5px;
    max-width: calc(100% - 8px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* 图标留着、文字收进屏幕阅读器可读的隐形区，比 display:none 更诚实 */
  .admin-user .btn-label,
  .user-site-link > span,
  .user-name-text,
  .pager-text {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .admin-user .btn {
    min-width: 38px;
    padding-left: 9px;
    padding-right: 9px;
  }

  .user-name {
    padding-left: 6px;
    border-left: 1px solid var(--line);
  }

  .admin-main {
    padding: 16px 14px 30px;
  }

  .card {
    padding: 16px;
    border-radius: 14px;
  }

  .card-head {
    margin-bottom: 16px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .stat-env {
    grid-column: 1 / -1;
  }

  /* iOS 上小于 16px 的输入框一聚焦就自动放大页面 */
  .input,
  select.input,
  textarea.input,
  input[type="search"].input {
    font-size: 16px;
  }

  .btn {
    min-height: 42px;
  }

  .btn-small {
    min-height: 34px;
  }

  .icon-btn {
    width: 36px;
  }

  .form-row,
  .form-row-3 {
    gap: 0 12px;
  }

  .list-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .filter-search,
  .filter-actions {
    grid-column: 1 / -1;
  }

  .filter-actions .btn {
    flex: 1;
  }

  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .photo-actions .btn {
    min-height: 36px;
  }

  .photo-grid .photo-actions .btn-label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .photo-info {
    padding: 10px;
  }

  .photo-title {
    font-size: 14px;
  }

  .upload-main .only-desktop {
    display: none;
  }

  .upload-main .only-mobile {
    display: inline;
  }

  .upload-link {
    display: none;
  }

  .modal {
    padding: 0;
    align-items: flex-end;
    justify-content: stretch;
  }

  .modal-card {
    width: 100%;
    max-width: none;
    max-height: 90vh;
    max-height: 90dvh;
    border-radius: 18px 18px 0 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
    overscroll-behavior: contain;
    animation: modal-in-mobile 0.25s ease;
  }

  @keyframes modal-in-mobile {
    from { transform: translateY(18px); }
    to { transform: translateY(0); }
  }

  .modal-card h2 {
    font-size: 19px;
  }

  .modal-close {
    top: 8px;
    right: 8px;
    width: 40px;
    height: 40px;
  }

  .form-actions .btn {
    flex: 1 1 auto;
  }

  .info-dl {
    grid-template-columns: minmax(72px, auto) 1fr;
    font-size: 12.5px;
  }

  .admin-footer {
    padding: 0 14px 24px;
  }
}

/* 手机竖屏更窄时，照片卡退回单列，按钮文字再放回来 */
@media (max-width: 400px) {
  .photo-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .photo-grid .photo-actions .btn-label {
    position: static;
    width: auto;
    height: auto;
    clip-path: none;
    overflow: visible;
  }
}

/* 触屏设备：去掉 hover 残留态 */
@media (hover: none) {
  .photo-card:hover {
    box-shadow: none;
  }

  .upload-zone:hover {
    border-color: var(--line-strong);
    background: var(--surface-2);
  }
}

/* 尊重系统的"减少动态效果" */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   v1.32.0 追加层：站点设置分组卡 + 分组导航 + 添加照片并排
   ========================================================= */

.page-head {
  margin: 2px 0 12px;
  padding: 0 2px;
}

.page-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.page-title .icon {
  font-size: 23px;
  color: var(--accent);
}

.section-nav {
  position: sticky;
  top: 66px;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  padding: 10px 0;
  background: linear-gradient(var(--bg) 72%, rgba(244, 245, 246, 0));
}

html[data-theme="dark"] .section-nav {
  background: linear-gradient(var(--bg) 72%, rgba(23, 24, 27, 0));
}

/* 横向滑动时留一条细滚动条，既不挡字也提示还能滑 */
.section-nav::-webkit-scrollbar {
  height: 4px;
}

.section-nav::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
}

.section-nav::-webkit-scrollbar-track {
  background: transparent;
}

.nav-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 12.5px;
  white-space: nowrap;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.nav-chip:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface-3);
}

.nav-chip .icon {
  font-size: 14px;
}

.nav-chip-accent {
  border-color: var(--pink-deep);
  background: var(--pink);
  color: var(--accent);
}

.nav-chip-accent:hover {
  color: var(--accent-deep);
  background: var(--pink-deep);
}

.form-card {
  scroll-margin-top: 138px;
}

.form-card .field:last-child,
.form-card .form-row:last-child,
.form-card .link-toolbar:last-child {
  margin-bottom: 0;
}

.form-actions-end {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 0;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.form-actions-end .btn-primary {
  min-width: 148px;
}

.add-row {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}

.add-row > .card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

/* 上传卡比外链卡矮一截，会让两张卡的边框错开。
   这里让虚线框吃掉多出来的高度（内容仍垂直居中），
   于是两张卡上下边完全齐平，而不是上传卡底下空一块。 */
.add-row .upload-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stat-bar {
  display: block;
  height: 4px;
  margin-top: 10px;
  border-radius: 999px;
  background: var(--track);
  overflow: hidden;
}

.stat-bar > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.4s ease;
}

/* 账号页三张卡：最后一张（部署信息）铺满整行 */
.two-col > :last-child {
  grid-column: 1 / -1;
}

@media (max-width: 1100px) {
  .add-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    margin-bottom: 0;
  }

  .add-row > .card {
    margin-bottom: 16px;
  }
}

@media (max-width: 760px) {
  .page-title {
    font-size: 21px;
  }

  .page-title .icon {
    font-size: 19px;
  }

  /* 手机上分组导航改成横向滑动的一排，不做吸顶（吸顶会吃掉首屏） */
  .section-nav {
    position: static;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 -14px 14px;
    padding: 4px 14px 8px;
    background: none;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--line-strong) transparent;
  }

  .nav-chip {
    scroll-snap-align: start;
    padding: 8px 12px;
  }

  .form-card {
    scroll-margin-top: 66px;
  }

  .form-actions-end {
    padding: 14px 16px;
  }

  .form-actions-end .btn {
    flex: 1 1 auto;
  }
}

/* =========================================================
   数据备份页
   ========================================================= */

.bk-set {
  margin: 0 0 16px;
}

.bk-set-title {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* 单选项做成小卡：选中态一眼能看出来，说明文字跟着选项走 */
.bk-opt {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  background: var(--surface-4);
  transition: border-color 0.18s ease, background 0.18s ease;
}

.bk-opt.is-active,
.bk-opt:has(> .input-radio:checked) {
  border-color: var(--accent);
  background: var(--card);
}

.bk-opt.is-disabled,
.check.is-disabled {
  opacity: 0.6;
}

.bk-opt-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.bk-opt-body {
  margin: 8px 0 0 26px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

.bk-opt-body .hint {
  display: block;
  margin-top: 6px;
}

/* 浏览器原生单选钮着色，省掉一层自绘控件的坑 */
.input-radio {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  margin: 0 10px 0 0;
  vertical-align: -3px;
  cursor: pointer;
}

/* JS 在的时候才折叠未选中的说明，没 JS 就两组说明都摆着，功能不受影响 */
.bk-js .bk-opt:not(.is-active) > .bk-opt-body {
  display: none;
}

/* 常驻提示：不复用 .alert，因为 .alert 会被后台脚本 6 秒后淡出删掉 */
.bk-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.7;
  background: var(--surface-3);
}

.bk-note .icon {
  flex: none;
  font-size: 15px;
  margin-top: 2px;
}

.bk-note-warn {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--warn);
}

.bk-note-info {
  background: var(--info-bg);
  border-color: var(--info-line);
  color: var(--info-ink);
}

.bk-note-error {
  background: var(--err-bg);
  border-color: var(--err-line);
  color: var(--danger);
}

.bk-preview-card {
  border-color: var(--accent);
  box-shadow: var(--shadow-pop);
}

.bk-diff {
  grid-template-columns: minmax(78px, auto) 1fr;
  margin-bottom: 14px;
}

.bk-diff dd {
  font-size: 12.5px;
}

.bk-files {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}

.bk-file {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-4);
}

.bk-file.is-new {
  border-color: var(--ok);
  background: var(--ok-bg);
}

.bk-file-main {
  min-width: 0;
  flex: 1 1 260px;
}

.bk-file-name {
  font-size: 13px;
  font-weight: 600;
  word-break: break-all;
}

.bk-file-meta {
  display: block;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.7;
}

.bk-file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* 覆盖导入是不可逆动作，按钮要真的比主按钮更“停一下” */
.btn-danger-solid {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn-danger-solid:hover {
  background: #8f2620;
  border-color: #8f2620;
  color: #fff;
}

html[data-theme="dark"] .btn-danger-solid {
  color: #17181b;
}

.btn[disabled],
.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn[disabled]:hover,
.btn:disabled:hover {
  background: var(--surface-3);
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-primary[disabled]:hover,
.btn-danger-solid[disabled]:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn-danger-solid[disabled]:hover {
  background: var(--danger);
  border-color: var(--danger);
}

@media (max-width: 760px) {
  .bk-file {
    flex-direction: column;
    gap: 10px;
  }

  .bk-file-actions {
    width: 100%;
  }

  .bk-file-actions .btn {
    flex: 1 1 auto;
  }

  .bk-opt-body {
    margin-left: 0;
  }

  .bk-diff {
    grid-template-columns: minmax(64px, auto) 1fr;
  }

  /* 预览卡里长文件名会顶破布局，允许它自己折行 */
  .bk-preview-card .hint code {
    word-break: break-all;
  }

  /* 手机上的文件选择框也按 16px 走，跟站内其它输入控件一个标准（.input.file 特异性比 .input 高，得再写一次） */
  .input.file {
    font-size: 16px;
    padding: 10px 12px;
  }
}

/* =========================================================
   自定义代码三格（站点设置 · 自定义代码）
   ========================================================= */

.input.code {
  /* 代码框固定用等宽字体：站长的自定义字体常常是手写体，缩进和 l / 1 这种字符会看不清。
     这里必须带 !important —— 自定义字体那条规则是 * , body { font-family: X !important } */
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace !important;
  line-height: 1.6;
  tab-size: 2;
  resize: vertical;
  white-space: pre;
  overflow-wrap: normal;
  overflow-x: auto;
}

/* 字号只在宽屏降到 13px：手机上必须留 16px，否则 iOS 聚焦会自动放大页面 */
@media (min-width: 761px) {
  .input.code {
    font-size: 13px;
  }
}

#s-code .field > .hint {
  margin-bottom: 6px;
}

/* 代码框的实时字数条（由 admin.js 插在框下方） */
.code-count {
  margin: 6px 0 0;
  font-size: 11.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.code-count.is-near {
  color: var(--warn);
}

.code-count.is-over {
  color: var(--danger);
  font-weight: 600;
}

.input.code.is-over {
  border-color: var(--danger);
  background: var(--err-bg);
}

/* ---------- 安全自检（数据备份页） ---------- */

.audit-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
}

.audit-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-4);
}

.audit-row .chip {
  flex: none;
  margin-top: 2px;
  white-space: nowrap;
}

.audit-chip-danger {
  background: var(--err-bg-2);
  color: var(--danger);
}

.audit-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.audit-title {
  font-size: 13px;
  font-weight: 600;
}

.audit-body .hint {
  word-break: break-all;
}
