* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f3f4f6;
  color: #1f2937;
  line-height: 1.5;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: #111827;
  color: #fff;
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .brand { font-weight: 600; font-size: 18px; }
.topbar .nav a { color: #d1d5db; margin-left: 16px; font-size: 14px; }
.topbar .nav a.active { color: #60a5fa; font-weight: 600; }
.topbar .nav a:hover { color: #fff; text-decoration: none; }

.layout { display: flex; min-height: calc(100vh - 56px); }
.sidebar {
  width: 220px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  padding: 18px 0;
}
.sidebar .sb-group { margin-bottom: 4px; }
.sidebar .sb-group.collapsed { margin-bottom: 2px; }
.sidebar .sb-group-title {
  padding: 10px 20px;
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: .5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  border-radius: 6px;
  margin: 0 8px;
  transition: background .15s;
}
.sidebar .sb-group-title:hover { background: #f3f4f6; }
.sidebar .sb-group-title .sb-toggle {
  font-size: 10px;
  color: #9ca3af;
  transition: transform .25s;
}
.sidebar .sb-group.collapsed .sb-group-title .sb-toggle {
  transform: rotate(-90deg);
}
.sidebar .sb-group .sb-items {
  overflow: hidden;
  max-height: 400px;
  transition: max-height .3s ease, opacity .25s ease;
  opacity: 1;
}
.sidebar .sb-group.collapsed .sb-items {
  max-height: 0;
  opacity: 0;
}
.sidebar a {
  display: block;
  padding: 10px 20px;
  color: #374151;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.sidebar a:hover { background: #f9fafb; text-decoration: none; }
.sidebar a.active { color: #2563eb; background: #eff6ff; border-left-color: #2563eb; font-weight: 600; }

.main { flex: 1; padding: 24px 28px 64px; }
.page-title { font-size: 20px; font-weight: 600; margin-bottom: 18px; color: #111827; }

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 22px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  margin-bottom: 20px;
}
.card h2 { font-size: 16px; margin-bottom: 14px; color: #111827; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar .search {
  display: flex;
  gap: 8px;
  flex: 1;
  min-width: 240px;
}
.toolbar input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}
.toolbar input:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }

.btn {
  display: inline-block;
  padding: 9px 16px;
  background: #2563eb;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s;
}
.btn:hover { background: #1d4ed8; }
.btn.secondary { background: #6b7280; }
.btn.secondary:hover { background: #4b5563; }
.btn.danger { background: #dc2626; }
.btn.danger:hover { background: #b91c1c; }
.btn.small { padding: 6px 12px; font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px; text-align: left; border-bottom: 1px solid #e5e7eb; }
th { background: #f9fafb; color: #374151; font-weight: 600; font-size: 14px; }
tr:hover td { background: #fafafa; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.gray { background: #f3f4f6; color: #4b5563; }
.badge.blue { background: #dbeafe; color: #1e40af; }

.pagination { margin-top: 14px; display: flex; gap: 8px; align-items: center; font-size: 13px; color: #6b7280; }
.pagination button { padding: 6px 12px; border: 1px solid #d1d5db; background: #fff; border-radius: 6px; cursor: pointer; font-size: 13px; }
.pagination button:disabled { opacity: .4; cursor: not-allowed; }

.center-col { display: flex; align-items: center; justify-content: center; min-height: calc(100vh - 56px); }
.auth-card { width: 100%; max-width: 420px; }
.auth-card .title { text-align: center; margin-bottom: 24px; font-size: 22px; font-weight: 600; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-section-title {
  grid-column: 1 / -1;
  font-size: 15px;
  font-weight: 600;
  color: #111827;
  padding-bottom: 4px;
  margin-top: 14px;
  border-bottom: 1px solid #e5e7eb;
}
.form-item label { display: block; font-size: 13px; color: #4b5563; margin-bottom: 6px; }
.form-item input, .form-item select, .form-item textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
  font-family: inherit;
}
.form-item textarea { resize: vertical; line-height: 1.6; }
.form-item input:focus, .form-item select:focus, .form-item textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.form-item .hint { font-size: 12px; color: #6b7280; margin-top: 4px; }

.upload-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 6px; }
.upload-box { background: #f9fafb; border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px; }
.upload-box label { display: block; font-size: 13px; color: #374151; margin-bottom: 10px; font-weight: 500; }
.upload-area { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.upload-area img { max-width: 100%; max-height: 180px; border: 1px solid #e5e7eb; border-radius: 6px; background: #fff; }
.upload-area img:not([src]), .upload-area img[src=""] { display: none; }

/* 系统配置模块 */
.config-container { display: flex; flex-direction: column; gap: 18px; }
.config-item .control { display: flex; flex-direction: column; gap: 6px; }
.upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upload-row img.thumb { max-width: 88px; max-height: 48px; border: 1px solid #e5e7eb; border-radius: 6px; background: #fff; }
.upload-row img.thumb:not([src]), .upload-row img.thumb[src=""] { display: none; }

/* 顶部栏 logo/文字 */
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; color: #fff; }
.topbar .brand img { max-height: 32px; max-width: 160px; object-fit: contain; display: none; }

/* 站点公告条 */
#siteNoticeBar {
  background: #fff7ed;
  color: #92400e;
  border-bottom: 1px solid #fdba74;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px;
  font-size: 13px;
}
#siteNoticeBar button {
  background: transparent; border: 0; color: #92400e; font-size: 20px; cursor: pointer; line-height: 1;
}

/* switch（布尔配置） */
.switch { position: relative; display: inline-block; width: 40px; height: 22px; vertical-align: middle; margin-right: 8px; }
.switch input { display: none; }
.switch .slider {
  position: absolute; inset: 0; background: #d1d5db; border-radius: 22px; transition: .2s;
}
.switch .slider::before {
  content: ""; position: absolute; width: 18px; height: 18px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s;
}
.switch input:checked + .slider { background: var(--brand-color, #2563eb); }
.switch input:checked + .slider::before { transform: translateX(18px); }

@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
  .upload-grid { grid-template-columns: 1fr; }
}

.modal-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  z-index: 100;
  align-items: center;
  justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff;
  border-radius: 10px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}
.modal h3 { margin-bottom: 16px; font-size: 17px; }
.modal .actions { margin-top: 18px; text-align: right; }
.modal .actions button { margin-left: 8px; }

.info-row { display: flex; padding: 10px 0; border-bottom: 1px dashed #e5e7eb; }
.info-row:last-child { border-bottom: none; }
.info-row .k { width: 120px; color: #6b7280; font-size: 14px; }
.info-row .v { flex: 1; font-size: 14px; color: #111827; }

.toast {
  position: fixed;
  top: 24px;
  right: 24px;
  background: #111827;
  color: #fff;
  padding: 12px 18px;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 999;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }

.footer { text-align: center; padding: 24px; color: #6b7280; font-size: 12px; }
.admin-footer {
  text-align: center;
  padding: 16px 24px;
  color: #6b7280;
  font-size: 12px;
  background: #f3f4f6;
  border-top: 1px solid #e5e7eb;
  position: fixed;
  bottom: 0;
  left: 220px;
  right: 0;
  z-index: 5;
}
.admin-footer a { color: #6b7280; }
.admin-footer a:hover { color: #2563eb; }

/* 管理表格 / 对话框 / 工具栏 */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar input {
  padding: 10px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}
.data-table { width: 100%; border-collapse: collapse; min-width: 600px; table-layout: fixed; }
.data-table thead th {
  text-align: left; background: #f8fafc; color: #374151; font-weight: 600; font-size: 13px;
  padding: 12px 14px; border-bottom: 1px solid #e5e7eb; white-space: nowrap;
}
.data-table tbody td {
  padding: 12px 14px; border-bottom: 1px solid #f1f5f9;
  color: #334155; font-size: 14px; vertical-align: middle;
  overflow: hidden; text-overflow: ellipsis;
}
.data-table tbody td.nowrap { white-space: nowrap; }
.data-table tbody tr:hover { background: #f8fafc; }

.dialog-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.dialog {
  background: #fff; border-radius: 12px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
  max-height: 85vh; display: flex; flex-direction: column; overflow: hidden;
}
.dialog-header, .dialog-footer {
  padding: 14px 20px; border-bottom: 1px solid #e5e7eb;
  display: flex; align-items: center; justify-content: space-between;
}
.dialog-footer { border-top: 1px solid #e5e7eb; border-bottom: 0; justify-content: flex-end; gap: 10px; }
.dialog-header span { font-weight: 600; color: #0f172a; font-size: 16px; }
.dialog-body { padding: 20px; overflow-y: auto; }
.btn.small { padding: 6px 12px; font-size: 13px; border-radius: 6px; }
.btn.danger { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; box-shadow: none; }
.btn.danger:hover { background: #fecaca; color: #991b1b; }

.info-row { display: flex; gap: 10px; padding: 6px 0; font-size: 14px; color: #334155; }
.info-row .k { min-width: 100px; color: #64748b; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 18px; }

/* ========== 管理员登录页（与用户端登录页同款） ========== */
:root {
  --c-primary: #3b82f6;
  --c-accent:  #f97316;
  --c-text:    #0f172a;
  --c-text-sub:#334155;
  --c-text-mute:#94a3b8;
  --font-md:   13px;
  --font-lg:   16px;
}

.auth-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, rgba(249, 115, 22, 0.18) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(6, 182, 212, 0.22) 0%, transparent 50%),
    linear-gradient(135deg, #eff6ff 0%, #e0e7ff 50%, #ecfeff 100%);
  display: flex;
  flex-direction: column;
  padding: 0;
}
.auth-page .auth-top {
  padding: 18px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255,255,255,0.7);
  border-bottom: 1px solid rgba(59, 130, 246, 0.15);
  backdrop-filter: blur(8px);
}
.auth-page .auth-top .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--c-text);
}
.auth-page .auth-top .brand img { max-height: 32px; }
.auth-page .auth-top .nav-links a {
  font-size: var(--font-md);
  color: var(--c-text-sub);
  margin-left: 20px;
  transition: color .15s;
  text-decoration: none;
}
.auth-page .auth-top .nav-links a:hover { color: var(--c-primary); }

.auth-page .auth-main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-page .auth-wrap {
  width: 100%;
  max-width: 960px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 0;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 20px 60px rgba(59, 130, 246, 0.18),
    0 8px 20px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(59, 130, 246, 0.08);
}
.auth-page .auth-hero {
  padding: 50px 40px;
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #06b6d4 100%);
  color: #fff;
  position: relative;
  overflow: hidden;
}
.auth-page .auth-hero::before,
.auth-page .auth-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
}
.auth-page .auth-hero::before { width: 260px; height: 260px; top: -80px; right: -80px; }
.auth-page .auth-hero::after  { width: 180px; height: 180px; bottom: -60px; left: -40px; background: rgba(249, 115, 22, 0.25); }
.auth-page .auth-hero-inner { position: relative; z-index: 1; }
.auth-page .auth-hero h2 {
  font-size: 26px;
  font-weight: 800;
  margin-bottom: 18px;
  line-height: 1.35;
}
.auth-page .auth-hero p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 24px;
}
.auth-page .auth-hero .feature-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.auth-page .auth-hero .feature-list li {
  padding: 10px 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.auth-page .auth-hero .feature-list li:last-child { border-bottom: none; }
.auth-page .auth-hero .feature-list li span.ico {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
}
.auth-page .auth-hero .brand-lg {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: 4px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff 0%, #fde68a 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1;
}
.auth-page .auth-hero .brand-sub {
  font-size: 14px;
  letter-spacing: 6px;
  opacity: 0.9;
  margin-bottom: 28px;
}
.auth-page .auth-hero .brand-badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: var(--font-md);
  margin-bottom: 14px;
  letter-spacing: 2px;
}

.auth-page .auth-form { padding: 40px 44px; }
.auth-page .auth-form .form-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--c-text);
  margin-bottom: 8px;
}
.auth-page .auth-form .form-subtitle {
  color: var(--c-text-mute);
  font-size: 13px;
  margin-bottom: 26px;
}
.auth-page .auth-form .field { margin-bottom: 18px; }
.auth-page .auth-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--c-text-sub);
  font-size: var(--font-md);
  font-weight: 500;
}
.auth-page .auth-form .input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-page .auth-form .input-wrap .ico {
  position: absolute;
  left: 14px;
  font-size: 15px;
  color: var(--c-text-mute);
  pointer-events: none;
}
.auth-page .auth-form .input-wrap input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  font-size: 14px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f8fafc;
  color: var(--c-text);
  outline: none;
  transition: all .18s;
  font-family: inherit;
}
.auth-page .auth-form .input-wrap input:focus {
  background: #fff;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}
.auth-page .auth-form .form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 14px 0 22px;
  font-size: 12px;
  color: var(--c-text-mute);
}
.auth-page .auth-form .submit-btn {
  width: 100%;
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #3b82f6, #06b6d4);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.35);
  transition: transform .15s, box-shadow .15s;
}
.auth-page .auth-form .submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 28px rgba(59, 130, 246, 0.45);
}
.auth-page .auth-form .alt-links {
  margin-top: 18px;
  text-align: center;
  font-size: 13px;
  color: var(--c-text-mute);
}
.auth-page .auth-form .alt-links a {
  color: var(--c-primary);
  text-decoration: none;
  margin: 0 4px;
}
.auth-page .auth-form .alt-links a:hover { text-decoration: underline; }

.auth-page .auth-footer {
  text-align: center;
  padding: 14px 28px 22px;
  font-size: 12px;
  color: var(--c-text-mute);
}
.auth-page .default-account {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff7ed, #fef9c3);
  border: 1px solid #fde68a;
  font-size: 12px;
  color: #92400e;
  text-align: center;
}
.auth-page .default-account b { color: #78350f; }

@media (max-width: 780px) {
  .auth-page .auth-wrap {
    grid-template-columns: 1fr;
    max-width: 420px;
  }
  .auth-page .auth-hero { display: none; }
    .auth-page .auth-form { padding: 32px 28px; }
  }

/* ========== 时间选择器（datetime-local） ========== */
.form-item input[type="datetime-local"] {
  padding: 10px 12px !important;
  font-size: 14px;
  font-family: inherit;
}

/* ========== 富文本编辑器 ========== */
.richtext-editor {
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}
.richtext-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-bottom: 1px solid #e2e8f0;
}
.richtext-toolbar button {
  min-width: 32px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: #fff;
  color: #334155;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.richtext-toolbar button:hover {
  background: #dbeafe;
  color: #1e40af;
  border-color: #93c5fd;
}
.richtext-toolbar .rt-sep {
  width: 1px;
  height: 18px;
  background: #cbd5e1;
  margin: 0 4px;
}
.richtext-toolbar .rt-color {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  height: 30px;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
}
.richtext-toolbar .rt-color input[type="color"] {
  width: 22px;
  height: 22px;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 0;
  cursor: pointer;
}
.richtext-content {
  min-height: 220px;
  max-height: 520px;
  padding: 16px 18px;
  overflow-y: auto;
  font-size: 14px;
  color: #1f2937;
  line-height: 1.7;
  outline: none;
}
.richtext-content:empty::before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}
.richtext-content p { margin: 0 0 10px; }
.richtext-content b, .richtext-content strong { font-weight: 700; color: #0f172a; }
.richtext-content i, .richtext-content em { font-style: italic; }
.richtext-content u { text-decoration: underline; }
.richtext-content s, .richtext-content strike { text-decoration: line-through; }
.richtext-content ul, .richtext-content ol { margin: 8px 0 12px 26px; }
.richtext-content ul li { list-style: disc; }
.richtext-content ol li { list-style: decimal; }
.richtext-content a { color: #2563eb; text-decoration: underline; }
.richtext-content a:hover { color: #1d4ed8; }
.richtext-content img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 10px 0;
  display: block;
  border: 1px solid #e2e8f0;
}
.richtext-content h1, .richtext-content h2, .richtext-content h3 {
  font-weight: 700;
  margin: 16px 0 10px;
  color: #0f172a;
}
.richtext-content h1 { font-size: 22px; }
.richtext-content h2 { font-size: 18px; }
.richtext-content h3 { font-size: 16px; }
.richtext-content:focus { background: #f8fafc; }
