.admin-body { background: var(--bg); }

/* 顶栏：悬停下拉（高优先级，覆盖 .top-nav a） */
.top-nav .nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 100;
}
.top-nav .nav-dropdown-btn {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 8px 14px !important;
  border-radius: 8px;
  background: #2563eb !important;
  color: #fff !important;
  font-weight: 600 !important;
  font-size: 0.9rem;
  font-family: inherit;
  border: 0 !important;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  box-shadow: none;
}
.top-nav .nav-dropdown-btn::after {
  content: '';
  display: inline-block;
  width: 0;
  height: 0;
  margin-left: 2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #fff;
  transition: transform 0.15s ease;
}
.top-nav .nav-dropdown:hover .nav-dropdown-btn,
.top-nav .nav-dropdown:focus-within .nav-dropdown-btn {
  background: #1d4ed8 !important;
}
.top-nav .nav-dropdown:hover .nav-dropdown-btn::after,
.top-nav .nav-dropdown:focus-within .nav-dropdown-btn::after {
  transform: rotate(180deg);
}

/* 默认隐藏；悬停/聚焦时纵向浮层弹出 */
.top-nav .nav-dropdown-menu {
  display: none !important;
  position: absolute !important;
  right: 0;
  top: calc(100% + 4px);
  min-width: 180px;
  margin: 0;
  padding: 6px !important;
  flex-direction: column !important;
  align-items: stretch !important;
  gap: 2px !important;
  background: #fff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14) !important;
  z-index: 200;
  box-sizing: border-box;
}
/* 桥接条：避免移向菜单时中间空隙导致收起 */
.top-nav .nav-dropdown-menu::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -8px;
  height: 8px;
  background: transparent;
}
.top-nav .nav-dropdown:hover .nav-dropdown-menu,
.top-nav .nav-dropdown:focus-within .nav-dropdown-menu {
  display: flex !important;
}

.top-nav .nav-dropdown-menu a,
.top-nav .nav-dropdown-menu a:visited {
  display: block !important;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px !important;
  margin: 0 !important;
  border-radius: 8px !important;
  color: #0f172a !important;
  background: transparent !important;
  font-weight: 500 !important;
  font-size: 0.9rem !important;
  line-height: 1.35;
  text-decoration: none !important;
  white-space: nowrap;
}
.top-nav .nav-dropdown-menu a:hover,
.top-nav .nav-dropdown-menu a:focus {
  background: #f1f5f9 !important;
  color: #2563eb !important;
  text-decoration: none !important;
  outline: none;
}
/* 管理页主区：随视口拉满，字段多的表格不再挤在 1100px 里 */
.admin-wrap {
  width: 100%;
  max-width: none;
  margin: 0 auto;
  padding: 22px 24px 40px;
  box-sizing: border-box;
}
@media (min-width: 1400px) {
  .admin-wrap {
    padding-left: 32px;
    padding-right: 32px;
  }
}
.admin-page-head {
  margin-bottom: 16px;
}
.admin-page-head.row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.admin-page-head h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
}
.admin-flash {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
}
.admin-flash.ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}
.admin-flash.error,
.admin-flash.err {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.admin-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}
.admin-card {
  display: block;
  padding: 18px 18px 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}
.admin-card:hover {
  border-color: #93c5fd;
  text-decoration: none;
}
.admin-card.muted-card { opacity: 0.95; }
.admin-card-kicker {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}
.admin-card-num {
  font-size: 2rem;
  font-weight: 700;
  margin: 6px 0;
  color: #0f172a;
}
.admin-card-desc {
  font-size: 0.88rem;
  color: var(--muted);
}
.admin-card-link {
  margin-top: 12px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.9rem;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.admin-search {
  flex: 1;
  min-width: 200px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.92rem;
  background: #fff;
}
.admin-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: #334155;
}

/* 宽表：吃满视口；窄屏才横滑。操作列 sticky 始终可见 */
.admin-table-wrap,
.table-scroll.admin-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.admin-table-wrap > table.admin-table,
.admin-table-wrap > table.data {
  width: 100%;
  min-width: 0;
  table-layout: auto;
  border-collapse: collapse;
  font-size: 0.86rem;
}
.admin-table td,
.admin-table th {
  vertical-align: middle;
  white-space: nowrap;
  padding: 8px 10px;
}
.admin-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--panel2, #f8fafc);
}
/* 邮箱：可收缩省略 */
.admin-table td code {
  display: inline-block;
  max-width: min(240px, 22vw);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}
.admin-table .admin-sig,
.admin-table .admin-cell-clip {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-table .admin-cell-dt {
  font-size: 0.8rem;
  color: #64748b;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.admin-table .admin-ops {
  white-space: nowrap;
}
/* 右侧操作列固定，避免横滑时找不到 */
.admin-table th.admin-ops-col,
.admin-table td.admin-ops {
  position: sticky;
  right: 0;
  z-index: 3;
  background: #fff;
  box-shadow: -6px 0 10px -8px rgba(15, 23, 42, 0.25);
  padding-left: 14px;
  padding-right: 12px;
}
.admin-table th.admin-ops-col {
  z-index: 4;
  background: var(--panel2, #f8fafc);
}
.admin-table tr:hover td.admin-ops {
  background: #fafbfc;
}
.admin-table tr.is-deleted { opacity: 0.55; }

/* 用户表：列更紧凑，优先一屏显示 */
.admin-table-users {
  width: 100% !important;
  min-width: 960px; /* 仅在极窄屏出现横滑 */
}
.admin-table-users th:nth-child(1),
.admin-table-users td:nth-child(1) { width: 44px; }   /* ID */
.admin-table-users th:nth-child(2),
.admin-table-users td:nth-child(2) { width: 52px; }   /* 头像 */
.admin-table-users th:nth-child(6),
.admin-table-users td:nth-child(6),
.admin-table-users th:nth-child(7),
.admin-table-users td:nth-child(7) { width: 56px; }   /* 国家 / 语言 */
.admin-table-users th:nth-child(9),
.admin-table-users td:nth-child(9) { width: 56px; }   /* 状态 */
.admin-table-users .admin-ops {
  min-width: 148px;
}

@media (min-width: 1280px) {
  .admin-table-users {
    min-width: 100%;
  }
  .admin-table-wrap > table.admin-table,
  .admin-table-wrap > table.data {
    min-width: 100%;
  }
}
.admin-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #0f172a;
}
.admin-num a {
  font-weight: 700;
  color: var(--accent, #2563eb);
  text-decoration: none;
}
.admin-num a:hover { text-decoration: underline; }
.admin-num .muted { font-weight: 500; font-size: 0.82em; }

/* 编辑页整体居中（用户 / 图纸 / 分类 / 专辑 等） */
.admin-edit-page {
  width: 100%;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
  box-sizing: border-box;
}
.admin-edit-page.admin-edit-wide {
  max-width: 800px;
}
.admin-edit-page.admin-edit-narrow {
  max-width: 560px;
}
.admin-edit-page .admin-form,
.admin-edit-page .admin-form-wide,
.admin-edit-page .admin-form-user {
  width: 100%;
  max-width: 100%;
  margin-left: 0;
  margin-right: 0;
}
.admin-user-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 18px;
  width: 100%;
}
@media (max-width: 900px) {
  .admin-user-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 560px) {
  .admin-user-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.admin-user-stat {
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: var(--shadow, 0 1px 2px rgba(15, 23, 42, 0.04));
  min-width: 0;
  box-sizing: border-box;
}
a.admin-user-stat.link {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
a.admin-user-stat.link:hover {
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}
.admin-page-head a.active-tab {
  color: var(--accent, #2563eb);
  font-weight: 700;
  text-decoration: none;
}
.admin-user-stat-k {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
}
.admin-user-stat-v {
  margin-top: 4px;
  font-size: 1.35rem;
  font-weight: 700;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
}
.admin-user-stat-v small {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  margin-top: 2px;
}

.admin-avatar-cell {
  width: 56px;
  text-align: center;
}
.admin-avatar {
  display: inline-block;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  border: 1px solid var(--line);
  background: #f1f5f9;
  vertical-align: middle;
}
.admin-avatar-ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: #64748b;
  background: #e2e8f0;
  user-select: none;
}
.admin-ops {
  white-space: nowrap;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.admin-ops a { font-weight: 600; }
.admin-ops form.inline { display: inline; margin: 0; }
.admin-ops .link-btn {
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.admin-ops .link-btn.danger { color: var(--err); }

.admin-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
}
.admin-status.s0 { background: #fef9c3; color: #a16207; }
.admin-status.s1 { background: #dcfce7; color: #166534; }
.admin-status.s2 { background: #fee2e2; color: #991b1b; }
.admin-status.s3 { background: #e2e8f0; color: #64748b; }

/* 所有管理表单默认水平居中 */
.admin-form {
  max-width: 560px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px 20px;
  box-shadow: var(--shadow);
  box-sizing: border-box;
}
.admin-form-wide {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* 用户编辑：加宽 + 分区 + 双列 */
.admin-form.admin-form-user {
  max-width: 960px;
  width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}
.admin-form-section {
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 12px;
  padding: 18px 20px 8px;
  margin-bottom: 14px;
  box-shadow: var(--shadow, 0 1px 2px rgba(15, 23, 42, 0.04));
  box-sizing: border-box;
}
.admin-form-section-title {
  margin: 0 0 14px;
  padding: 0 0 10px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
}
.admin-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0 14px;
}
.admin-field-grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}
.admin-field-grid-2 .admin-field-span-2 {
  grid-column: 1 / -1;
}
@media (max-width: 720px) {
  .admin-field-grid-2 {
    grid-template-columns: 1fr;
  }
  .admin-field-grid-2 .admin-field-span-2 {
    grid-column: auto;
  }
}
.admin-field code {
  font-size: 0.78rem;
  font-weight: 500;
  color: #64748b;
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 4px;
}
.admin-select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.92rem;
  background: #fff;
  min-width: 120px;
}
.admin-cover-cell {
  width: 64px;
  text-align: center;
}
.admin-cover {
  display: inline-block;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  object-position: center;
  border: 1px solid var(--line);
  background: #f1f5f9;
  vertical-align: middle;
}
.admin-cover-ph {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #64748b;
  background: #e2e8f0;
  user-select: none;
}
.admin-field {
  display: block;
  margin-bottom: 14px;
}
.admin-field span {
  display: block;
  margin-bottom: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #475569;
}
.admin-field em { color: var(--err); font-style: normal; }
.admin-field input,
.admin-field select,
.admin-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
  background: #fff;
  font-family: inherit;
  resize: vertical;
}
.admin-field input:focus,
.admin-field select:focus,
.admin-field textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.admin-sig {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.88rem;
  color: #475569;
}
.admin-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
  padding: 4px 0 8px;
}
.admin-form-user .admin-form-actions {
  padding: 4px 2px 12px;
}

.admin-batch-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  border-radius: 10px;
}
.admin-batch-bar .try-btn {
  padding: 6px 12px;
  font-size: 0.88rem;
}
.admin-check-col {
  width: 36px;
  text-align: center;
  vertical-align: middle !important;
}
.admin-check-col input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.admin-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}
.admin-pager a {
  min-width: 32px;
  text-align: center;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: #334155;
  text-decoration: none;
  font-size: 0.88rem;
}
.admin-pager a.active {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--accent);
  font-weight: 700;
}
