.admin-body {
  background: var(--bg);
  min-height: 100vh;
}

.admin-wrap {
  max-width: 1080px;
  margin: 0 auto;
  padding: 30px 24px 60px;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

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

.admin-brand h1 {
  margin: 0;
  font-size: 19px;
  font-weight: 650;
  letter-spacing: -.02em;
}

.admin-brand p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--text-3);
}

.back-btn {
  flex: none;
  padding: 8px 14px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-1);
}

.stat-card span {
  display: block;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 4px;
}

.stat-card b {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -.02em;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 20px 16px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-1);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.panel-head p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: var(--text-3);
  max-width: 560px;
  line-height: 1.6;
}

.panel-head p b { color: var(--text-2); }

.search-input {
  width: 220px;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-soft);
  font-size: 13px;
  outline: 0;
}

.search-input:focus {
  background: #fff;
  border-color: #b9b7f4;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

.tag-create {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  margin-bottom: 14px;
  background: var(--surface-soft);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}

.tag-create input[type="text"] {
  flex: 1;
  height: 34px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
  outline: 0;
}

.tag-create input[type="text"]:focus {
  border-color: #b9b7f4;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

.tag-create .primary-btn { padding: 8px 14px; font-size: 13px; }

input[type="color"] {
  width: 34px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 10px 12px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: 0; }

.data-table tbody tr:hover { background: #fbfbfe; }

.cell-name-input,
.cell-name-input:focus {
  width: 100%;
  max-width: 240px;
  height: 32px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  font-size: 13px;
  outline: 0;
}

.cell-name-input:focus {
  border-color: #b9b7f4;
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

.count-badge {
  display: inline-block;
  min-width: 26px;
  text-align: center;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-2);
}

.row-actions { display: flex; gap: 6px; }

.mini-btn {
  padding: 5px 11px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  white-space: nowrap;
  transition: all .15s;
}

.mini-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--surface-soft);
}

.mini-btn.is-danger:hover {
  color: var(--danger);
  border-color: #f3c9cb;
  background: var(--danger-soft);
}

.mini-btn.is-primary {
  border-color: #dcdcff;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.mini-btn.is-primary:hover { background: #e4e4ff; }

.cell-title a {
  color: var(--text);
  font-weight: 550;
  text-decoration: none;
  display: block;
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-title a:hover { color: var(--accent); }

.cell-sub {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-3);
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-tags { display: flex; flex-wrap: wrap; gap: 4px; }

.cell-tags .tag-pill { font-size: 11px; }

.muted { color: var(--text-3); }

.panel-note {
  margin: 10px 2px 0;
  font-size: 12px;
  color: var(--text-3);
}

.admin-foot {
  margin-top: 26px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

.admin-foot code {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 11.5px;
}

.empty-row td {
  text-align: center;
  color: var(--text-3);
  padding: 26px 12px !important;
}

/* 顶部按钮组 / 工具行 */

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

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(140deg, #6366f1, #4f46e5 55%, #4338ca);
  box-shadow: 0 6px 14px -6px rgba(79, 70, 229, .8);
  flex: none;
}

.panel-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.bm-icon {
  width: 30px;
  height: 30px;
  font-size: 15px;
  border-radius: 8px;
}

.bm-icon img { padding: 2px; }

/* 站点设置 */

.site-form { max-width: 560px; }

/* 上传按钮：不参与 flex 拉伸 */
.icon-row .upload-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  height: 42px;
}

/* 背景图设置 */
.bg-row {
  display: flex;
  gap: 12px;
  align-items: stretch;
}

.bg-preview {
  width: 132px;
  height: 76px;
  flex: none;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--border);
  background:
    radial-gradient(120px 60px at 80% 0%, rgba(120, 170, 255, .5), transparent 70%),
    linear-gradient(150deg, #3d6ab5, #17284c);
  color: rgba(255, 255, 255, .78);
  font-size: 11.5px;
}

.bg-preview img { width: 100%; height: 100%; object-fit: cover; }

.bg-side {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bg-side input[type="text"] {
  width: 100%;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-soft);
  font-size: 13px;
  outline: 0;
}

.bg-side input[type="text"]:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

.bg-buttons { display: flex; gap: 8px; }

.dim-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-2);
}

.dim-row input[type="range"] { flex: 1; accent-color: var(--accent); }

.dim-row b {
  min-width: 42px;
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* 登录 */

/* 修复：display:grid 会覆盖 hidden 属性的默认 display:none，导致登录后遮罩不消失 */
.login-overlay[hidden],
[hidden] {
  display: none !important;
}

.login-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(120, 170, 255, .3), transparent 60%),
    linear-gradient(158deg, #3d6ab5 0%, #2a4c8f 45%, #17284c 100%);
  z-index: 100;
}

.login-card {
  width: min(360px, 100%);
  padding: 30px 26px 24px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-3);
  text-align: center;
}

.login-mark {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  margin: 0 auto 14px;
}

.login-card h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -.01em;
}

.login-card p {
  margin: 4px 0 18px;
  font-size: 12.5px;
  color: var(--text-3);
}

.login-card .field { text-align: left; }

.login-btn { width: 100%; justify-content: center; padding: 10px; font-size: 14px; }

.login-error {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--danger);
  min-height: 18px;
}

@media (max-width: 720px) {
  .admin-wrap { padding: 18px 14px 40px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .panel-head { flex-direction: column; }
  .panel-tools { width: 100%; }
  .search-input { width: 100%; flex: 1; }
  .tag-create { flex-wrap: wrap; }
}
