:root {
  --side: #001529;
  --side-hover: #000c17;
  --primary: #1890ff;
  --primary-hover: #40a9ff;
  --success: #52c41a;
  --info: #13c2c2;
  --danger: #ff4d4f;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #1f1f1f;
  --muted: #8c8c8c;
  --border: #f0f0f0;
  --line: #e8e8e8;
  --radius: 6px;
  --side-w: 220px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* —— 登录 —— */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #001529 0%, #003a8c 55%, #1890ff 100%);
}
.login-card {
  width: 400px;
  max-width: calc(100vw - 32px);
  background: #fff;
  border-radius: 8px;
  padding: 40px 36px 32px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.login-brand {
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  letter-spacing: .12em;
}
.login-sub {
  text-align: center;
  color: var(--muted);
  margin: 8px 0 28px;
}
.btn-block { width: 100%; margin-top: 8px; }

/* —— 布局 —— */
.admin-body { min-height: 100vh; }
.side {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--side-w);
  background: var(--side);
  color: rgba(255,255,255,.75);
  z-index: 40;
  display: flex;
  flex-direction: column;
  transition: width .2s;
  overflow: hidden;
}
.brand {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--primary);
  display: grid; place-items: center;
  font-weight: 700;
  flex-shrink: 0;
}
.brand-text { font-size: 15px; font-weight: 600; line-height: 1.2; white-space: nowrap; }
.brand-text small { display: block; font-size: 11px; font-weight: 400; opacity: .55; }

.menu { padding: 8px 8px 12px; overflow-y: auto; flex: 1; }
.menu-block { margin-bottom: 4px; }
.menu-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px 6px;
  font-size: 12px;
  color: rgba(255,255,255,.4);
  letter-spacing: .08em;
  border: 0;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.menu-group:hover { color: rgba(255,255,255,.78); }
.menu-caret {
  font-style: normal;
  font-size: 11px;
  line-height: 1;
  opacity: .7;
  transition: transform .18s ease;
}
.menu-block.is-closed .menu-caret { transform: rotate(-90deg); }
.menu-sub {
  overflow: hidden;
  max-height: 720px;
  transition: max-height .22s ease, opacity .18s ease;
}
.menu-block.is-closed .menu-sub {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}
.menu a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,.75);
  padding: 10px 12px;
  border-radius: 4px;
  margin-bottom: 2px;
  white-space: nowrap;
}
.menu a:hover { color: #fff; background: rgba(255,255,255,.08); }
.menu a.on { color: #fff; background: var(--primary); }
.menu .ico {
  width: 22px; height: 22px;
  border-radius: 4px;
  background: rgba(255,255,255,.08);
  display: grid; place-items: center;
  font-size: 12px;
  font-style: normal;
  flex-shrink: 0;
}

.shell {
  margin-left: var(--side-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .2s;
}
.side-fold { --side-w: 64px; }
.side-fold .brand-text,
.side-fold .menu-group,
.side-fold .menu a span { display: none; }
.side-fold .menu a { justify-content: center; padding: 12px 0; }
.side-fold .brand { justify-content: center; padding: 0; }
.side-fold .menu-block.is-closed .menu-sub {
  max-height: none;
  opacity: 1;
  pointer-events: auto;
}
.side-fold .side-toggle { transform: rotate(180deg); }

.side-toggle {
  flex-shrink: 0;
  height: 40px;
  border: 0;
  border-top: 1px solid rgba(255,255,255,.08);
  background: transparent;
  color: rgba(255,255,255,.55);
  cursor: pointer;
  font-size: 16px;
  letter-spacing: 0;
}
.side-toggle:hover { color: #fff; background: rgba(255,255,255,.06); }
.side-mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 35;
}

.topbar {
  height: 50px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 30;
}
.crumb { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--primary); }
.crumb .sep { opacity: .45; }
.crumb strong { color: var(--text); font-weight: 600; }
.fold {
  border: 0;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text);
}
.top-right { display: flex; align-items: center; gap: 16px; }
.who { color: var(--text); }
.link-out { color: var(--muted); }
.link-out:hover { color: var(--danger); }

.tabs {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 0 16px;
  display: flex;
  gap: 4px;
}
.tab {
  display: inline-block;
  padding: 10px 14px;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab.on { color: var(--primary); border-bottom-color: var(--primary); }

.main { padding: 16px; flex: 1; }

/* —— 面板 / 卡片 —— */
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
  margin-bottom: 16px;
  overflow: hidden;
}
.panel-hd {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.panel-hd.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.panel-hd .muted { font-weight: 400; font-size: 13px; }
.panel-bd { padding: 16px; }
.lead { color: var(--text); line-height: 1.7; margin: 0; }
.muted { color: var(--muted); line-height: 1.7; margin: 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 720px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .side {
    transform: translateX(-100%);
    width: min(80vw, 240px);
    --side-w: min(80vw, 240px);
    box-shadow: 8px 0 24px rgba(0,0,0,.18);
  }
  .shell { margin-left: 0; }
  body.side-open .side { transform: none; }
  body.side-open .side-mask { display: block; }
  .side-fold { --side-w: min(80vw, 240px); }
  .side-fold .brand-text,
  .side-fold .menu-group,
  .side-fold .menu a span { display: unset; }
  .side-fold .menu a { justify-content: flex-start; padding: 10px 12px; }
  .side-fold .brand { justify-content: flex-start; padding: 0 16px; }
  .side-fold .menu-block.is-closed .menu-sub {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
  }
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.stat-n { font-size: 28px; font-weight: 700; color: var(--primary); line-height: 1.1; }
.stat-l { margin-top: 6px; color: var(--muted); font-size: 13px; }

/* —— 按钮 —— */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { color: var(--primary); border-color: var(--primary); }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-info {
  background: #e6fffb;
  border-color: #87e8de;
  color: #13c2c2;
}
.btn-info:hover { background: #13c2c2; border-color: #13c2c2; color: #fff; }
.btn-danger {
  background: #fff1f0;
  border-color: #ffa39e;
  color: #cf1322;
}
.btn-danger:hover {
  background: #cf1322;
  border-color: #cf1322;
  color: #fff;
}
.col-check {
  width: 42px;
  text-align: center;
  vertical-align: middle;
}
.col-check input {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* —— 筛选 / 表单 —— */
.filter {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
}
.filter label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 200px;
}
.filter label span,
.form-label {
  color: var(--muted);
  font-size: 13px;
}
.filter input,
.form input,
.form textarea,
.login-card input,
.login-card select {
  height: 32px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  padding: 4px 11px;
  font: inherit;
  background: #fff;
  width: 100%;
}
.login-card select {
  cursor: pointer;
}
.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 18px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.login-remember input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}
.form textarea { height: auto; padding: 8px 11px; }
.filter input:focus,
.form input:focus,
.form textarea:focus,
.login-card input:focus,
.login-card select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(24,144,255,.15);
}
.filter-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.form-item { display: block; margin-bottom: 16px; }
.form-item .form-label { display: block; margin-bottom: 6px; }

.rich-editor {
  min-height: 280px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.rich-editor .ql-toolbar {
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
  background: #fafafa;
}
.rich-editor .ql-container {
  border: none;
  font-size: 14px;
  min-height: 220px;
}
.rich-editor .ql-editor {
  min-height: 220px;
  line-height: 1.7;
}
.form-actions { display: flex; gap: 8px; margin-top: 8px; }

/* —— 表格 —— */
.table-wrap { padding-top: 0; overflow-x: auto; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th,
.data-table td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}
.data-table th {
  background: #fafafa;
  color: rgba(0,0,0,.85);
  font-weight: 600;
  white-space: nowrap;
}
.data-table tbody tr:hover { background: #fafafa; }
.th-sort {
  color: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}
.th-sort:hover { color: var(--primary); }
.th-sort.is-active { color: var(--primary); }
.th-sort-hint {
  color: var(--muted);
  font-weight: 400;
  font-size: 12px;
}
.th-sort-mark {
  font-size: 12px;
  line-height: 1;
}
.col-ops { width: 140px; }
.ops a { margin-right: 10px; }
.ops a.danger { color: var(--danger); }
.empty { text-align: center; color: var(--muted); padding: 32px 12px !important; }
.thumb {
  width: 36px; height: 36px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #fafafa;
  display: block;
}
.pager { margin-top: 0; color: var(--muted); }
.pager a, .pager span { margin-right: 0; }
.pager-bar {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.pager-size {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}
.pager-size select {
  min-width: 64px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  background: #fff;
}
.pager ul,
.pager .pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.pager li {
  list-style: none;
  margin: 0;
}
.pager a,
.pager span,
.pager li > a,
.pager li > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.pager .active span,
.pager li.active > span,
.pager li.active > a {
  background: var(--primary, #c23a2b);
  border-color: var(--primary, #c23a2b);
  color: #fff;
}
.pager .disabled span,
.pager li.disabled > span {
  opacity: 0.45;
  cursor: default;
}
.pager-jump {
  display: inline-flex;
  align-items: center;
}
.pager-jump-form {
  display: inline-flex;
  margin: 0;
}
.pager-jump-input {
  box-sizing: border-box;
  width: 52px;
  height: 32px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  text-align: center;
  font-size: 13px;
  -moz-appearance: textfield;
}
.pager-jump-input::-webkit-outer-spin-button,
.pager-jump-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.pager-jump-input:focus {
  outline: none;
  border-color: var(--primary, #c23a2b);
}
.pager-jump-input.is-mid {
  border-color: var(--primary, #c23a2b);
  color: var(--primary, #c23a2b);
  font-weight: 600;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
@media (max-width: 720px) {
  .form-grid-2 { grid-template-columns: 1fr; }
}

.cat-upload {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.cat-upload-preview {
  width: 96px;
  height: 96px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fafafa;
}
.cat-upload-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cat-upload-actions { flex: 1; min-width: 220px; }
.cat-upload-actions input[type="file"] { margin-bottom: 8px; }

.unlock-box {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 16px 4px;
  margin: 0 0 16px;
}
.unlock-box legend {
  padding: 0 8px;
  font-weight: 600;
}
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.form-check input { width: auto; }
.cat-own-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px 12px;
  margin-top: 8px;
}
.cat-own-item code {
  font-size: 11px;
  color: var(--muted);
}

/* —— 提示 —— */
.alert {
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 16px;
}
.alert.ok {
  background: #f6ffed;
  border: 1px solid #b7eb8f;
  color: #389e0d;
}
.alert.err {
  background: #fff2f0;
  border: 1px solid #ffccc7;
  color: var(--danger);
}
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: #e8e0d0;
}
.tag.warn {
  background: #f3d9a8;
  color: #8a4e10;
}
.tag.ok {
  background: #d7ead6;
  color: #2f6b3a;
}

/* —— 功能开关 —— */
.feature-lead {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.7;
}
.feature-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 720px;
}
.feature-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.feature-main {
  display: flex;
  align-items: center;
  gap: 16px;
}
.feature-users {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px 10px 60px;
}
.feature-users-lab {
  flex: 0 0 72px;
  font-size: 12px;
  color: var(--muted);
}
.feature-users-inp {
  flex: 1;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
}
.feature-users-inp:focus {
  outline: none;
  border-color: #91d5ff;
  box-shadow: 0 0 0 2px rgba(24,144,255,.12);
}
.feature-card:hover {
  background: #fff;
  border-color: #d6e4ff;
  box-shadow: 0 2px 8px rgba(24,144,255,.08);
}
.feature-card.is-on {
  background: #f6ffed;
  border-color: #b7eb8f;
}
.feature-ico {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  flex: 0 0 44px;
}
.feature-ico.guild { background: linear-gradient(135deg, #5a7a9a, #3d5a78); }
.feature-ico.welfare { background: linear-gradient(135deg, #c23a2b, #e85d4c); }
.feature-ico.farm { background: linear-gradient(135deg, #7a9a6a, #5a7a4a); }
.feature-ico.fish { background: linear-gradient(135deg, #5a8aaa, #3d6a88); }
.feature-meta { flex: 1; min-width: 0; }
.feature-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.feature-state {
  font-size: 12px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 10px;
  line-height: 18px;
}
.feature-state.on { background: #f6ffed; color: #389e0d; border: 1px solid #b7eb8f; }
.feature-state.off { background: #fff1f0; color: #cf1322; border: 1px solid #ffa39e; }
.feature-desc {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.feature-switch {
  position: relative;
  width: 48px;
  height: 26px;
  flex: 0 0 48px;
}
.feature-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 48px !important;
  height: 26px !important;
  margin: 0;
  cursor: pointer;
  z-index: 2;
}
.feature-switch i {
  display: block;
  width: 48px;
  height: 26px;
  border-radius: 13px;
  background: #bfbfbf;
  transition: background .2s;
  pointer-events: none;
}
.feature-switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .2s;
}
.feature-switch input:checked + i { background: #52c41a; }
.feature-switch input:checked + i::after { transform: translateX(22px); }
.feature-switch input:focus-visible + i { box-shadow: 0 0 0 3px rgba(82,196,26,.25); }
.feature-actions {
  max-width: 720px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
