:root {
  --primary: #2f6fed;
  --primary-dark: #1f56c4;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2329;
  --text-2: #646a73;
  --border: #e5e6eb;
  --radius: 10px;
  --danger: #e5484d;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.hidden {
  display: none !important;
}

/* —— 通用 —— */
.center-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.card {
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 32px;
  width: 100%;
  max-width: 360px;
}

.card h1 {
  font-size: 20px;
  margin-bottom: 18px;
  text-align: center;
}

input,
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  background: #fff;
  font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-dark);
}

.btn.ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
}

.btn.ghost:hover {
  background: #eef0f4;
}

.error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 10px;
}

.back-link {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
}

#passwordBtn {
  width: 100%;
  margin-top: 12px;
}

/* —— 顶栏 —— */
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.admin-topbar .title {
  font-size: 17px;
  font-weight: 700;
}

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

.filter-group {
  display: flex;
  gap: 6px;
  background: var(--bg);
  padding: 3px;
  border-radius: 999px;
}

.chip {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}

.chip.active {
  background: var(--primary);
  color: #fff;
}

.search {
  width: 240px;
  padding: 7px 12px;
}

.admin-link {
  color: var(--text-2);
  font-size: 13px;
  text-decoration: none;
}

/* —— 列表 —— */
.list-wrap {
  max-width: 900px;
  margin: 18px auto;
  padding: 0 20px;
}

.form-wrap {
  max-width: 640px;
}

.list-meta {
  color: var(--text-2);
  font-size: 13px;
  margin-bottom: 12px;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.list-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow, 0 2px 10px rgba(31, 35, 41, 0.08));
}

.list-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: #e8e9ed;
  flex-shrink: 0;
}

.list-main {
  flex: 1;
  min-width: 0;
}

.list-name {
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #eef0ff;
  color: var(--primary);
}

.badge.food {
  background: #fff4e6;
  color: #e8810d;
}

.list-sub {
  font-size: 12px;
  color: var(--text-2);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-date {
  font-size: 12px;
  color: var(--text-2);
  flex-shrink: 0;
}

.empty {
  text-align: center;
  color: var(--text-2);
  padding: 40px 0;
}

/* —— 表单 —— */
.form-row {
  margin-bottom: 16px;
}

.form-row label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-2);
}

.form-row .hint {
  font-size: 12px;
  color: #b3b6bd;
  margin-top: 4px;
}

.radio-group {
  display: flex;
  gap: 8px;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  margin: 0;
}

.radio-group input {
  width: auto;
}

.radio-group label.selected {
  border-color: var(--primary);
  background: #eef3ff;
  color: var(--primary);
}

/* 图片只读区 */
.photos-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photos-preview img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border-radius: 8px;
  cursor: zoom-in;
  background: #e8e9ed;
  border: 1px solid var(--border);
}

.photos-empty {
  color: #b3b6bd;
  font-size: 13px;
}

/* 大图 */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 6px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(31, 35, 41, 0.92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  z-index: 3000;
  opacity: 0;
  transition: opacity 0.2s;
}

.toast.show {
  opacity: 1;
}

@media (max-width: 640px) {
  .admin-topbar {
    flex-wrap: wrap;
  }

  .controls {
    flex-wrap: wrap;
    width: 100%;
  }

  .search {
    width: 100%;
  }
}

/* —— 批量操作面板 —— */
.batch-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  background: #fff8e6;
  border-bottom: 1px solid #ffe18d;
  flex-wrap: wrap;
}

.batch-bar .batch-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #8a6d00;
}

.batch-bar .batch-field input {
  padding: 5px 10px;
  border: 1px solid #e4c74a;
  border-radius: 6px;
  font-size: 13px;
  min-width: 160px;
  background: #fff;
}

.batch-bar .batch-field input:focus {
  outline: none;
  border-color: #f0a800;
}

.batch-bar .btn {
  font-size: 13px;
  padding: 6px 14px;
}

/* 批量模式下列表行样式 */
.list-item.selectable {
  cursor: pointer;
}

.list-item.selectable .row-check {
  margin-right: 12px;
  transform: scale(1.1);
  accent-color: var(--primary);
}

#batchToggleBtn.active {
  background: #f0a800;
  border-color: #f0a800;
  color: #fff;
}