/* 主题变量 — 其余尽量用 Bootstrap 工具类 */
:root {
  --bs-primary: #111827;
  --bs-primary-rgb: 17, 24, 39;
  --bs-link-color: #111827;
  --bs-link-hover-color: #374151;
  --bs-border-radius: 0.625rem;
  --bs-body-bg: #f8fafc;
  --admin-sidebar-w: 248px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bs-body-bg);
}

.hidden { display: none !important; }

.btn-primary {
  --bs-btn-bg: #111827;
  --bs-btn-border-color: #111827;
  --bs-btn-hover-bg: #374151;
  --bs-btn-hover-border-color: #374151;
  --bs-btn-active-bg: #1f2937;
  --bs-btn-active-border-color: #1f2937;
}

/* 侧栏 */
.admin-shell { min-height: 100vh; }

.admin-sidebar {
  width: var(--admin-sidebar-w);
  flex-shrink: 0;
}

.admin-brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  background: transparent;
}

.admin-brand-logo-lg {
  width: 44px;
  height: 44px;
}

.admin-sidebar .nav-link {
  color: #64748b;
  font-size: 0.875rem;
  padding: 0.55rem 0.75rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.admin-sidebar .nav-link i {
  font-size: 1rem;
  width: 1.25rem;
  text-align: center;
}

.admin-sidebar .nav-link:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.admin-sidebar .nav-link.active {
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 600;
}

.admin-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-content {
  flex: 1;
  padding: 1.25rem 1.5rem 2rem;
}

/* 页面头 */
.page-head {
  margin-bottom: 1rem;
}

.page-head h1 {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  color: #0f172a;
}

.page-head p {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: #64748b;
}

/* 表格缩略图 */
.img-thumb {
  width: 64px;
  height: 44px;
  object-fit: cover;
  border-radius: 0.375rem;
  border: 1px solid var(--bs-border-color);
  background: #fff;
}

.img-gradient {
  width: 64px;
  height: 44px;
  border-radius: 0.375rem;
}

.img-empty,
.img-thumb-fallback {
  width: 64px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  color: #94a3b8;
  border: 1px dashed var(--bs-border-color);
  border-radius: 0.375rem;
  background: #fff;
}

.img-load-failed code {
  word-break: break-all;
  font-size: 0.75rem;
}

.crop-stage {
  width: 100%;
  height: min(60vh, 520px);
  min-height: 280px;
}

.crop-stage > img {
  display: block;
  max-width: none;
}

.crop-stage .cropper-container {
  width: 100% !important;
}

/* 裁剪弹窗必须高于 TinyMCE 对话框 (.tox-tinymce-aux z-index:1300) */
#imageCropModal.modal {
  z-index: 20060 !important;
}

body.crop-modal-open .modal-backdrop.show {
  z-index: 20050 !important;
}

.image-preview-lg {
  width: 120px;
  height: 80px;
}

.image-preview-lg .img-thumb,
.image-preview-lg .img-empty,
.image-preview-lg .img-gradient {
  width: 120px;
  height: 80px;
}

/* 登录 */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
}

.login-page .card {
  width: min(400px, 92vw);
}

/* CMS 入口卡片 hover */
.cms-entry-card {
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.cms-entry-card:hover {
  box-shadow: 0 0.5rem 1.25rem rgba(15, 23, 42, 0.08) !important;
  transform: translateY(-2px);
}

@media (max-width: 991.98px) {
  .admin-sidebar {
    width: 100%;
    border-end: none !important;
    border-bottom: 1px solid var(--bs-border-color) !important;
  }

  .admin-sidebar .nav {
    flex-direction: row !important;
    flex-wrap: wrap;
    overflow-x: auto;
  }
}

.admin-toast-host {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 30000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.admin-toast {
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  color: #fff;
  background: rgba(30, 41, 59, 0.92);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.admin-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.admin-toast-success {
  background: rgba(22, 101, 52, 0.92);
}

.admin-toast-error {
  background: rgba(153, 27, 27, 0.92);
}

.contact-sort-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.contact-sort-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.contact-sort-item.contact-sort-drag-over {
  border-color: #0d6efd;
  border-style: dashed;
}

.contact-sort-item.contact-sort-dragging {
  opacity: 0.55;
}

.contact-sort-handle {
  width: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #adb5bd;
  cursor: grab;
  user-select: none;
}

.contact-sort-handle:active {
  cursor: grabbing;
}

.contact-sort-check {
  flex-shrink: 0;
}

.contact-sort-thumb {
  flex-shrink: 0;
}

.contact-sort-body {
  flex: 1;
  min-width: 0;
}

.contact-sort-order {
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}

.contact-sort-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
