:root {
  --sidebar-w: 260px;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #1f2937;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #07c160;
  --primary-dark: #06ad56;
  --primary-soft: #e8faf0;
  --sidebar-bg: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  --sidebar-text: #94a3b8;
  --sidebar-active: #ffffff;
  --danger: #ef4444;
  --warning: #f59e0b;
  --success: #10b981;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.04);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

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

a { color: inherit; text-decoration: none; }

/* —— Shell —— */
.admin-shell {
  display: flex;
  min-height: 100vh;
}

/* —— Sidebar —— */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar__brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

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

.sidebar__logo-icon {
  width: 40px;
  height: auto;
  max-height: 40px;
  display: block;
  object-fit: contain;
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  flex-shrink: 0;
}

.sidebar__title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
}

.sidebar__subtitle {
  font-size: 12px;
  color: var(--sidebar-text);
  margin-top: 2px;
}

.sidebar__nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.sidebar__section {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  padding: 8px 12px 6px;
  margin-top: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  margin-bottom: 4px;
  transition: all 0.2s ease;
  font-size: 14px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(7, 193, 96, 0.25) 0%, rgba(7, 193, 96, 0.08) 100%);
  color: var(--sidebar-active);
  font-weight: 500;
  box-shadow: inset 3px 0 0 var(--primary);
}

.nav-item__icon {
  width: 22px;
  text-align: center;
  font-size: 16px;
  opacity: 0.9;
}

.sidebar__footer {
  padding: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 10px;
}

.sidebar__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.sidebar__user-name {
  font-size: 13px;
  color: #e2e8f0;
  font-weight: 500;
}

.sidebar__user-role {
  font-size: 11px;
  color: var(--sidebar-text);
}

.btn-logout {
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: #cbd5e1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

/* —— Main —— */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 20px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar__title {
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.topbar__desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.content {
  padding: 24px 28px 40px;
  flex: 1;
}

/* —— Alerts —— */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success {
  background: var(--primary-soft);
  color: #047857;
  border: 1px solid #a7f3d0;
}

/* —— Cards —— */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card + .card { margin-top: 20px; }

.page-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-actions__hint {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
  line-height: 1.6;
}

/* —— Buttons —— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(7, 193, 96, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(7, 193, 96, 0.4);
}

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

.btn-danger:hover { background: #dc2626; }

.btn-outline {
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* —— Tabs —— */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 4px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  width: fit-content;
}

.tabs a {
  padding: 8px 16px;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

.tabs a:hover { color: var(--text); }

.tabs a.active {
  background: var(--card);
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
}

/* —— Table —— */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

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

thead {
  background: #f8fafc;
}

th {
  padding: 14px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tbody tr:hover { background: #fafbfc; }

tbody tr:last-child td { border-bottom: none; }

.table-thumb {
  width: 72px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* —— Badges —— */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-pending { background: #fef3c7; color: #b45309; }
.badge-approved { background: #d1fae5; color: #047857; }
.badge-rejected { background: #fee2e2; color: #b91c1c; }
.badge-pinned { background: #dbeafe; color: #1d4ed8; }

/* —— Forms —— */
.form-grid {
  max-width: 640px;
}

.form-grid--wide {
  max-width: 100%;
}

.content-fallback {
  display: none;
  width: 100%;
  min-height: 200px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: monospace;
}

.content-fallback--visible {
  display: block !important;
  margin-top: 12px;
}

.editor-error {
  color: #b91c1c;
  font-size: 13px;
  margin-top: 8px;
  padding: 10px;
  background: #fef2f2;
  border-radius: 6px;
}

.form-group { margin-bottom: 20px; }

label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="file"],
textarea,
select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fff;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.15);
}

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

.form-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.form-check input { width: auto; }

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.form-preview-img {
  max-width: 280px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin: 8px 0 12px;
}

code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #475569;
}

form.inline { display: inline; }

.field-hint {
  color: var(--text-muted);
  font-size: 12px;
  margin: 0 0 10px;
  line-height: 1.5;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.checkbox-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}

.checkbox-chip:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 500;
}

.checkbox-chip input {
  width: auto;
  margin: 0;
}

/* TinyMCE 编辑区 */
.tox-tinymce {
  border-radius: var(--radius-sm) !important;
  border-color: var(--border) !important;
}

#content-input {
  min-height: 400px;
  font-family: inherit;
}

.empty-cell {
  color: var(--text-muted);
  text-align: center;
  padding: 40px !important;
}

/* —— Pagination —— */
.pagination-wrap {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.pagination-wrap .admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.pagination-wrap .admin-pagination__info {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
}

.pagination-wrap .admin-pagination__info strong {
  color: var(--text);
  font-weight: 600;
}

.pagination-wrap .admin-pagination__nav {
  flex-shrink: 0;
  max-width: 100%;
}

.pagination-wrap .admin-pagination__pages {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.pagination-wrap .admin-pagination__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text);
  background: #fff;
  text-decoration: none;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  box-sizing: border-box;
  cursor: pointer;
  line-height: 1;
}

.pagination-wrap a.admin-pagination__btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.pagination-wrap .admin-pagination__btn--active {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(7, 193, 96, 0.25);
}

.pagination-wrap .admin-pagination__btn--disabled {
  color: #9ca3af;
  background: #f8fafc;
  border-color: var(--border);
  cursor: not-allowed;
}

.pagination-wrap .admin-pagination__btn--ellipsis {
  border: none;
  background: transparent;
  min-width: 28px;
  padding: 0 4px;
  color: var(--text-muted);
  cursor: default;
}

@media (max-width: 640px) {
  .pagination-wrap .admin-pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .pagination-wrap .admin-pagination__nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .pagination-wrap .admin-pagination__pages {
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }
}

/* —— Login —— */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.login-card__brand {
  text-align: center;
  margin-bottom: 32px;
}

.login-card__icon {
  width: 80px;
  height: auto;
  max-height: 80px;
  margin: 0 auto 16px;
  display: block;
  object-fit: contain;
  background: none;
  border: none;
  box-shadow: none;
  border-radius: 0;
  padding: 0;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
}

.login-card__sub {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
}

.login-error {
  background: #fef2f2;
  color: #b91c1c;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 20px;
  border: 1px solid #fecaca;
}

.login-card .btn-primary {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  margin-top: 8px;
}
