/* ================================================================
   桐峻记忆 - 后台管理样式表
   版本: v1.0
   兼容: IE9+ / Chrome / Firefox / Edge / 360浏览器
   配色: #8b7355 主色调, #f5f0e8 背景, #faf8f5 卡片背景
   ================================================================ */

/* ---- Reset & Base ---- */
*, *:before, *:after {
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
}
html, body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: #4a3f35;
  background-color: #f5f0e8;
  height: 100%;
  overflow: hidden;
}
a {
  color: #8b7355;
  text-decoration: none;
}
a:hover {
  color: #6b5b4f;
}

/* ---- Admin Login Page ---- */
.admin-login-page {
  background-color: #f5f0e8;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}
.login-wrapper {
  width: 100%;
  max-width: 380px;
  padding: 20px;
}
.login-box {
  background-color: #ffffff;
  border-radius: 12px;
  padding: 40px 32px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  -webkit-box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.login-logo {
  text-align: center;
  margin-bottom: 24px;
}
.login-logo h1 {
  font-size: 24px;
  color: #8b7355;
  margin: 0 0 6px;
  font-weight: 600;
}
.login-logo p {
  font-size: 13px;
  color: #a09080;
  margin: 0;
}
.login-error {
  background-color: #fdeaea;
  color: #e74c3c;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
  border: 1px solid #f5c6cb;
}
.login-form .form-group {
  margin-bottom: 16px;
}
.login-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: #6b5b4f;
  font-weight: 500;
}
.login-form input[type="text"],
.login-form input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #e8ddd0;
  border-radius: 8px;
  font-size: 14px;
  background-color: #faf8f5;
  color: #4a3f35;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-transition: border-color 0.2s, box-shadow 0.2s;
}
.login-form input[type="text"]:focus,
.login-form input[type="password"]:focus {
  outline: none;
  border-color: #8b7355;
  box-shadow: 0 0 0 3px rgba(139,115,85,0.12);
  -webkit-box-shadow: 0 0 0 3px rgba(139,115,85,0.12);
}

/* ---- Admin Layout ---- */
.admin-body {
  background-color: #f5f0e8;
  height: 100vh;
  overflow: hidden;
}
.admin-layout,
.admin-wrapper {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ---- Sidebar ---- */
.admin-sidebar {
  width: 220px;
  background-color: #ffffff;
  border-right: 1px solid #e8ddd0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar-header {
  padding: 24px 20px 16px;
  border-bottom: 1px solid #f0ebe2;
}
.sidebar-header h2 {
  font-size: 18px;
  color: #8b7355;
  margin: 0;
  font-weight: 600;
}
.sidebar-header .sidebar-icon {
  font-size: 20px;
  margin-right: 6px;
}
.sidebar-header .sidebar-title {
  font-size: 16px;
  color: #8b7355;
  font-weight: 600;
}
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}
.sidebar-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar-nav li {
  margin: 2px 0;
}
.sidebar-nav li a,
.sidebar-nav .sidebar-item {
  display: block;
  padding: 11px 20px;
  color: #6b5b4f;
  font-size: 14px;
  transition: all 0.2s;
  -webkit-transition: all 0.2s;
  border-left: 3px solid transparent;
}
.sidebar-nav li a:hover,
.sidebar-nav .sidebar-item:hover {
  background-color: #faf8f5;
  color: #8b7355;
}
.sidebar-nav li.active a,
.sidebar-nav .sidebar-item.active {
  background-color: #faf8f5;
  color: #8b7355;
  border-left-color: #8b7355;
  font-weight: 600;
}
.sidebar-nav .icon {
  display: inline-block;
  width: 22px;
  text-align: center;
  margin-right: 8px;
  font-size: 15px;
}

/* ---- Nav Item (new sidebar structure) ---- */
.sidebar-nav .nav-item {
  display: block;
  padding: 11px 20px;
  color: #6b5b4f;
  font-size: 14px;
  transition: all 0.2s;
  -webkit-transition: all 0.2s;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.sidebar-nav .nav-item:hover {
  background-color: #faf8f5;
  color: #8b7355;
}
.sidebar-nav .nav-item.active {
  background-color: #faf8f5;
  color: #8b7355;
  border-left-color: #8b7355;
  font-weight: 600;
}
.sidebar-nav .nav-item .icon {
  display: inline-block;
  width: 22px;
  text-align: center;
  margin-right: 8px;
  font-size: 15px;
}
.sidebar-nav .nav-external {
  color: #8b7355;
  font-weight: 500;
}
.sidebar-nav .nav-external:hover {
  background-color: #f5f0e8;
}
.sidebar-nav .nav-logout {
  color: #c0392b;
}
.sidebar-nav .nav-logout:hover {
  background-color: #fdf0ee;
  color: #e74c3c;
}
.sidebar-nav .nav-divider {
  height: 1px;
  background: #f0ebe2;
  margin: 8px 12px;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  gap: 8px;
}
.sidebar-logo-icon {
  font-size: 20px;
}
.sidebar-logo-img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.version-tag {
  font-size: 11px;
  color: #c0b0a0;
}
.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid #f0ebe2;
  font-size: 12px;
  color: #a09080;
}
.sidebar-footer .username {
  display: block;
  margin-bottom: 6px;
  color: #6b5b4f;
  font-weight: 500;
}
.sidebar-footer .logout-link,
.sidebar-footer a {
  color: #c0392b;
  font-size: 12px;
}
.sidebar-footer .logout-link:hover,
.sidebar-footer a:hover {
  color: #e74c3c;
}

/* ---- Main Content ---- */
.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}
.admin-header {
  background-color: #ffffff;
  padding: 16px 24px;
  border-bottom: 1px solid #e8ddd0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.admin-header h1,
.admin-title {
  font-size: 20px;
  color: #4a3f35;
  margin: 0;
  font-weight: 600;
}
.admin-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background-color: #f5f0e8;
}

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 6px;
  background-color: #e8ddd0;
  color: #6b5b4f;
  transition: all 0.2s;
  -webkit-transition: all 0.2s;
  text-decoration: none;
}
.btn:hover {
  background-color: #ddd5c8;
  color: #4a3f35;
}
.btn-primary {
  background-color: #8b7355;
  color: #ffffff;
  border-color: #8b7355;
}
.btn-primary:hover {
  background-color: #6b5b4f;
  border-color: #6b5b4f;
  color: #ffffff;
}
.btn-secondary {
  background-color: #e8ddd0;
  color: #6b5b4f;
  border-color: #d0c4b8;
}
.btn-secondary:hover {
  background-color: #ddd5c8;
  color: #4a3f35;
}
.btn-danger {
  background-color: #e74c3c;
  color: #ffffff;
  border-color: #e74c3c;
}
.btn-danger:hover {
  background-color: #c0392b;
  border-color: #c0392b;
  color: #ffffff;
}
.btn-success {
  background-color: #27ae60;
  color: #ffffff;
  border-color: #27ae60;
}
.btn-success:hover {
  background-color: #219a52;
  border-color: #219a52;
  color: #ffffff;
}
.btn-sm {
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 4px;
}
.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
  border-radius: 8px;
}
.btn-block {
  display: block;
  width: 100%;
}
.btn-edit {
  background-color: #8b7355;
  color: #ffffff;
}
.btn-edit:hover {
  background-color: #6b5b4f;
  color: #ffffff;
}

/* ---- Alerts ---- */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 14px;
}
.alert-success {
  background-color: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
}
.alert-danger {
  background-color: #fdeaea;
  color: #c0392b;
  border: 1px solid #f5c6cb;
}
.alert-warning {
  background-color: #fff3e0;
  color: #e65100;
  border: 1px solid #ffe0b2;
}

/* ---- Forms ---- */
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #6b5b4f;
}
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e8ddd0;
  border-radius: 6px;
  font-size: 14px;
  background-color: #ffffff;
  color: #4a3f35;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-transition: border-color 0.2s, box-shadow 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #8b7355;
  box-shadow: 0 0 0 3px rgba(139,115,85,0.12);
  -webkit-box-shadow: 0 0 0 3px rgba(139,115,85,0.12);
}
.form-group textarea {
  resize: vertical;
  line-height: 1.6;
}
.form-group input[type="color"] {
  width: 44px;
  height: 36px;
  padding: 2px;
  cursor: pointer;
}
.form-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e8ddd0;
  border-radius: 6px;
  font-size: 13px;
  background-color: #ffffff;
  color: #4a3f35;
  font-family: inherit;
}
.form-input:focus {
  outline: none;
  border-color: #8b7355;
  box-shadow: 0 0 0 3px rgba(139,115,85,0.12);
}
.form-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: #a09080;
  line-height: 1.5;
}
.form-actions {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #e8ddd0;
}

/* ---- Color Input Group ---- */
.color-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.color-input-group input[type="color"] {
  width: 40px;
  height: 32px;
  padding: 2px;
  border: 1px solid #e8ddd0;
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
}
.color-input-group input[type="text"] {
  width: 120px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: 'Courier New', monospace;
}

/* ---- Color Grid (Settings) ---- */
.color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 8px;
}
.color-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.color-item input[type="color"] {
  width: 40px;
  height: 32px;
  padding: 2px;
  border: 1px solid #e8ddd0;
  border-radius: 4px;
  cursor: pointer;
}
.color-item .color-text {
  width: 90px;
  padding: 5px 8px;
  font-size: 12px;
  font-family: 'Courier New', monospace;
  border: 1px solid #e8ddd0;
  border-radius: 4px;
  text-align: center;
}
.color-item .color-label {
  font-size: 11px;
  color: #a09080;
}

/* ---- Settings Form ---- */
.settings-form {
  max-width: 100%;
}

/* ---- Settings Section ---- */
.settings-section {
  background-color: #ffffff;
  border-radius: 10px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.settings-section h3 {
  font-size: 16px;
  color: #4a3f35;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0ebe2;
  font-weight: 600;
}
.settings-section-title {
  font-size: 16px;
  color: #4a3f35;
  margin: 0 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0ebe2;
  font-weight: 600;
}
.settings-section h3 small {
  font-size: 13px;
  margin-left: 8px;
}
.settings-section h4 {
  font-size: 14px;
  color: #6b5b4f;
  margin: 0 0 12px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid #f5f0e8;
  gap: 16px;
}
.settings-row:last-child {
  border-bottom: none;
}
.settings-row > div:first-child {
  flex: 1;
  min-width: 0;
}
.settings-label {
  font-size: 14px;
  font-weight: 500;
  color: #4a3f35;
  margin-bottom: 3px;
}
.settings-desc {
  font-size: 12px;
  color: #a09080;
  line-height: 1.4;
}

.settings-col {
  flex: 1;
  min-width: 280px;
}
.settings-col label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #6b5b4f;
}

/* ---- Preview Box ---- */
.preview-box {
  border: 1px solid #e8ddd0;
  border-radius: 6px;
  padding: 12px;
  min-height: 80px;
  background-color: #faf8f5;
  font-size: 14px;
  overflow: auto;
  max-height: 200px;
}

/* ---- Media Type Tabs ---- */
.media-type-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.media-tab {
  padding: 10px 20px;
  border: 1px solid #e8ddd0;
  border-radius: 8px;
  background: #faf8f5;
  color: #6b5b4f;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  text-align: center;
}
.media-tab:hover {
  border-color: #8b7355;
  background: #f5f0e8;
}
.media-tab.active {
  border-color: #8b7355;
  background: #8b7355;
  color: #fff;
}

/* ---- Video Badge ---- */
.badge-video {
  background: #e3f2fd;
  color: #1565c0;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  margin-left: 6px;
  vertical-align: middle;
  display: inline-block;
}

/* ---- Video Preview in Admin ---- */
.video-preview-player {
  width: 100%;
  max-height: 240px;
  border-radius: 8px;
  background: #000;
}

/* ---- Button Row ---- */
.btn-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

/* ---- Filter Select ---- */
.filter-select {
  padding: 8px 12px;
  border: 1px solid #e8ddd0;
  border-radius: 6px;
  font-size: 13px;
  background-color: #ffffff;
  color: #4a3f35;
  font-family: inherit;
  cursor: pointer;
  min-width: 120px;
}
.filter-select:focus {
  outline: none;
  border-color: #8b7355;
  box-shadow: 0 0 0 3px rgba(139,115,85,0.12);
}

/* ---- Stats Cards ---- */
.stats-cards {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -6px 24px;
}
.stat-card {
  width: 25%;
  padding: 0 6px;
  margin-bottom: 12px;
}
.stat-card-inner {
  background-color: #ffffff;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.stat-icon {
  width: 32px;
  height: 32px;
  margin: 0 auto 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.stat-icon svg {
  display: block;
  width: 32px;
  height: 32px;
}
.stat-number {
  font-size: 28px;
  font-weight: 700;
  color: #8b7355;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 13px;
  color: #a09080;
}

/* ---- Quick Actions ---- */
.quick-actions {
  margin-bottom: 24px;
}
.quick-actions .btn {
  margin-right: 8px;
  margin-bottom: 8px;
}

/* ---- Data Table ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background-color: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.data-table thead {
  background-color: #faf8f5;
}
.data-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #6b5b4f;
  border-bottom: 1px solid #f0ebe2;
}
.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  color: #4a3f35;
  border-bottom: 1px solid #f5f0e8;
  vertical-align: middle;
}
.data-table tbody tr:hover {
  background-color: #faf8f5;
}
.data-table tbody tr:last-child td {
  border-bottom: none;
}
.data-table .text-center {
  text-align: center;
}

/* ---- Post Form ---- */
.post-form {
  max-width: 800px;
}

/* ---- Image Upload Area ---- */
.image-upload-area {
  border: 2px dashed #e8ddd0;
  border-radius: 10px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-transition: all 0.2s;
  position: relative;
  background-color: #faf8f5;
}
.image-upload-area:hover {
  border-color: #8b7355;
  background-color: #f8f5f0;
}
.image-upload-area.dragover {
  border-color: #8b7355;
  background-color: #f0ebe2;
}
.image-upload-area .upload-placeholder {
  pointer-events: none;
}
.image-upload-area .upload-icon {
  font-size: 36px;
  display: block;
  margin-bottom: 8px;
}
.image-upload-area p {
  font-size: 15px;
  color: #6b5b4f;
  margin: 0 0 6px;
  font-weight: 500;
}
.image-upload-area .upload-hint {
  font-size: 12px;
  color: #a09080;
}
.image-input {
  display: none;
}

/* ---- Media Type Tabs ---- */
.media-type-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.media-tab {
  padding: 10px 20px;
  border: 1px solid #e8ddd0;
  border-radius: 8px;
  background: #faf8f5;
  color: #6b5b4f;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  text-align: center;
}
.media-tab:hover {
  border-color: #8b7355;
  background: #f5f0e8;
}
.media-tab.active {
  border-color: #8b7355;
  background: #8b7355;
  color: #fff;
}

/* ---- Video Thumbnail ---- */
.video-thumbnail-box {
  position: relative;
  display: inline-block;
  max-width: 320px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid #e8ddd0;
}
.video-thumbnail-box img {
  width: 100%;
  display: block;
}
.video-thumbnail-box .thumb-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 10px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  font-size: 12px;
  text-align: center;
}

/* ---- Video Badge ---- */
.video-badge-admin {
  display: inline-block;
  padding: 2px 8px;
  background: #e3f2fd;
  color: #1565c0;
  border-radius: 4px;
  font-size: 12px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ---- Video Player in Admin ---- */
.video-preview-player {
  width: 100%;
  max-height: 240px;
  border-radius: 8px;
  background: #000;
}

/* ---- Image Preview List ---- */
.image-preview-list {
  margin-top: 16px;
  overflow: hidden;
}
.image-preview-item {
  position: relative;
  float: left;
  width: 140px;
  height: 140px;
  margin: 0 6px 12px;
  border: 1px solid #e8ddd0;
  border-radius: 6px;
  overflow: hidden;
  background-color: #faf8f5;
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
  -moz-box-sizing: border-box;
}
.image-preview-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.image-preview-item .btn-remove-image {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  background-color: rgba(231,76,60,0.9);
  color: #fff;
  font-size: 14px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}
.image-preview-item .btn-remove-image:hover {
  background-color: #c0392b;
}
.image-preview-item.uploading {
  border: 2px dashed #8b7355;
  background-color: #f5f0e8;
}
.image-preview-item.uploading img {
  opacity: 0.4;
}
.image-preview-item .upload-status {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  -webkit-transform: translate(-50%, -50%);
  background-color: rgba(139,115,85,0.9);
  color: #fff;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
}
.image-preview-item.uploaded .upload-status {
  display: none;
}

/* ---- Tag Suggestions ---- */
.tag-suggestions {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #f0ebe2;
}
.suggestion-label {
  font-size: 12px;
  color: #a09080;
  margin-bottom: 6px;
}
.tag-suggestion {
  display: inline-block;
  padding: 3px 10px;
  margin: 0 6px 6px 0;
  background-color: #f5f0e8;
  border-radius: 12px;
  font-size: 12px;
  color: #8b7355;
  cursor: pointer;
  transition: background-color 0.2s;
  -webkit-transition: background-color 0.2s;
}
.tag-suggestion:hover {
  background-color: #e8ddd0;
}

/* ---- Status Badge ---- */
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.status-publish {
  background-color: #e8f5e9;
  color: #2e7d32;
}
.status-draft {
  background-color: #fff3e0;
  color: #e65100;
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 24px;
  gap: 4px;
}
.pagination a,
.pagination span {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: #6b5b4f;
  background-color: #ffffff;
  border: 1px solid #e8ddd0;
  min-width: 36px;
  text-align: center;
}
.pagination a:hover {
  background-color: #faf8f5;
  color: #8b7355;
}
.pagination .current {
  background-color: #8b7355;
  color: #ffffff;
  border-color: #8b7355;
}
.pagination .disabled {
  color: #d0c4b8;
  cursor: not-allowed;
}

/* ---- Modal ---- */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0,0,0,0.65);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  overflow: auto;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal-overlay.show {
  display: flex;
}
.modal {
  background-color: #ffffff;
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(0,0,0,0.35);
  border: 2px solid #ffffff;
  position: relative;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 2px solid #e8ddd0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #faf7f2;
}
.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #3d2e22;
  margin: 0;
}
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #7a6b5a;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.modal-close:hover {
  background-color: #e8ddd0;
  color: #3d2e22;
}
.modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
  background: #ffffff;
  color: #4a3f35;
  font-size: 15px;
  line-height: 1.6;
}
.modal-footer {
  padding: 14px 24px;
  border-top: 2px solid #e8ddd0;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: #faf7f2;
}

/* ---- Editor Toolbar ---- */
.editor-toolbar {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
  padding: 8px;
  background-color: #faf8f5;
  border-radius: 6px;
  border: 1px solid #f0ebe2;
}
.editor-toolbar .btn {
  min-width: 36px;
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 600;
}

/* ---- Confirm Dialog ---- */
.confirm-dialog {
  text-align: center;
  padding: 8px 4px;
}
.confirm-dialog p {
  margin: 0 0 20px;
  font-size: 15px;
  color: #4a3f35;
  line-height: 1.6;
}
.confirm-dialog .btn {
  margin: 0 6px;
  min-width: 80px;
}

/* ---- Empty State ---- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #a09080;
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
}
.empty-state-text {
  font-size: 16px;
  font-weight: 500;
  color: #6b5b4f;
  margin-bottom: 6px;
}
.empty-state-hint {
  font-size: 13px;
}

/* ---- Text helpers ---- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-muted { color: #a09080; }
.text-danger { color: #e74c3c; }
.text-success { color: #27ae60; }

/* ---- Trash page ---- */
.trash-tip {
  font-size: 13px;
  color: #a09080;
  background: #faf6ef;
  border: 1px solid #efe6d8;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 0 0 16px;
  line-height: 1.6;
}
.trash-tip a { color: #c4956a; font-weight: 600; }
.trash-tip strong { color: #e74c3c; }

/* ---- Clearfix ---- */
.clearfix:before,
.clearfix:after {
  content: " ";
  display: table;
}
.clearfix:after {
  clear: both;
}

/* ---- Responsive ---- */
@media screen and (max-width: 1024px) {
  .stat-card { width: 50%; margin-bottom: 12px; }
  .settings-row { flex-direction: column; align-items: flex-start; }
}
@media screen and (max-width: 768px) {
  .admin-sidebar { width: 60px; }
  .sidebar-header h2,
  .sidebar-title,
  .sidebar-footer .username,
  .sidebar-footer .logout-link,
  .sidebar-nav .icon + *,
  .sidebar-nav li a {
    font-size: 0;
  }
  .sidebar-nav .icon { font-size: 18px; margin: 0; width: auto; }
  .sidebar-nav li a,
  .sidebar-nav .sidebar-item {
    text-align: center;
    padding: 14px 0;
  }
  .admin-content { padding: 16px; }
  .stat-card { width: 50%; }
  .data-table { font-size: 12px; }
  .data-table th,
  .data-table td { padding: 8px 10px; }
  .image-preview-item { width: 100px; height: 100px; }
  .color-grid { gap: 10px; }
  .modal { width: 95%; }
}
@media screen and (max-width: 480px) {
  .stat-card { width: 100%; }
  .admin-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .settings-section { padding: 16px; }
}

/* ---- HTML Editor Toolbar ---- */
.html-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 8px 10px;
  background: #faf7f2;
  border: 1px solid #e8ddd0;
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  align-items: center;
}
.html-editor-toolbar .ed-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid #e8ddd0;
  border-radius: 4px;
  background: #fff;
  color: #6b5b4f;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-transition: all 0.15s;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  vertical-align: middle;
}
.html-editor-toolbar .ed-btn:hover {
  background: #8b7355;
  color: #fff;
  border-color: #8b7355;
}
.html-editor-toolbar .ed-btn:active {
  background: #6b5b4f;
}
.html-editor-toolbar .ed-divider {
  display: inline-block;
  width: 1px;
  height: 22px;
  background: #e0d5c8;
  margin: 0 3px;
  vertical-align: middle;
}
.html-editor-toolbar .ed-color-swatch {
  width: 28px;
  height: 28px;
  border: 1px solid #e8ddd0;
  border-radius: 4px;
  cursor: pointer;
  vertical-align: middle;
  padding: 0;
}
.html-editor-toolbar .ed-select {
  height: 30px;
  border: 1px solid #e8ddd0;
  border-radius: 4px;
  background: #fff;
  color: #6b5b4f;
  font-size: 12px;
  padding: 0 6px;
  cursor: pointer;
  vertical-align: middle;
}
.html-editor-textarea {
  border-radius: 0 0 6px 6px !important;
  border-top: 1px solid #e8ddd0 !important;
}

/* ---- Sidebar Toggle Button ---- */
.sidebar-toggle-btn {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: #6b5b4f;
  cursor: pointer;
  padding: 4px 8px;
}
@media screen and (max-width: 768px) {
  .sidebar-toggle-btn { display: inline-block; }
  .admin-sidebar {
    position: absolute;
    z-index: 1000;
    height: 100%;
    transition: transform 0.3s;
  }
  .admin-sidebar.sidebar-hidden {
    transform: translateX(-100%);
  }
}

/* ---- Card Title Text (front-end) ---- */
.card-title-text {
  font-size: 15px;
  font-weight: 600;
  color: #4a3f35;
  margin-bottom: 6px;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ---- Sidebar External Link ---- */
.sidebar-nav .sidebar-external {
  border-top: 1px solid #f0ebe2;
  margin-top: 8px;
  padding-top: 8px;
}
.sidebar-nav .sidebar-section-label {
  padding: 8px 20px 4px;
  font-size: 11px;
  color: #c0b0a0;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ---- 标题列单行截断 ---- */
.posts-table .title-cell,
.trash-table .title-cell {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 260px;
}
.posts-table .title-cell a {
  vertical-align: middle;
}

/* ---- 常用地点标签云（单选） ---- */
.location-suggest {
  display: inline-block;
  padding: 3px 10px;
  margin: 2px 4px 2px 0;
  font-size: 12px;
  color: #8b7355;
  background: #f5f0e8;
  border: 1px solid #e8ddd0;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  -webkit-transition: all 0.2s ease;
}
.location-suggest:hover {
  background: #ebe4d6;
  border-color: #d0c4b0;
}
.location-suggest.active {
  background: #8b7355;
  color: #fff;
  border-color: #8b7355;
}

/* ================================================================
   v8 追加样式
   ================================================================ */

/* ---- 封面选中高亮（修复问题2） ---- */
.image-preview-item.cover-selected {
  border: 3px solid #8b7355 !important;
  box-shadow: 0 0 0 3px rgba(139,115,85,0.3), 0 4px 16px rgba(139,115,85,0.25) !important;
}
.image-preview-item .cover-badge {
  display: none;
  position: absolute;
  bottom: 6px;
  left: 6px;
  background: linear-gradient(135deg, #8b7355, #6b5b4f);
  color: #fff;
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  letter-spacing: 1px;
  z-index: 2;
  pointer-events: none;
}
.image-preview-item.cover-selected .cover-badge {
  display: block;
}

/* ---- 操作按钮补充 ---- */
.btn-view {
  background-color: #2980b9;
  color: #ffffff;
}
.btn-view:hover {
  background-color: #2471a3;
  color: #ffffff;
}
.btn-delete {
  background-color: #e74c3c;
  color: #ffffff;
}
.btn-delete:hover {
  background-color: #c0392b;
  color: #ffffff;
}

/* ---- 徽章 ---- */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  vertical-align: middle;
  margin-left: 6px;
}
.badge-draft {
  background-color: #fff3e0;
  color: #e65100;
}
.badge-publish {
  background-color: #e8f5e9;
  color: #2e7d32;
}

/* ---- 标签标签 ---- */
.tag-label {
  display: inline-block;
  padding: 2px 8px;
  margin: 2px 3px 2px 0;
  background-color: #f5f0e8;
  border-radius: 10px;
  font-size: 12px;
  color: #8b7355;
}

/* ---- 编辑器按钮（修复类名不匹配问题3） ---- */
.html-editor-toolbar .editor-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid #e8ddd0;
  border-radius: 4px;
  background: #fff;
  color: #6b5b4f;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-transition: all 0.15s;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
  vertical-align: middle;
}
.html-editor-toolbar .editor-btn:hover {
  background: #8b7355;
  color: #fff;
  border-color: #8b7355;
}
.html-editor-toolbar .editor-btn:active {
  background: #6b5b4f;
}
.editor-separator {
  display: inline-block;
  width: 1px;
  height: 22px;
  background: #e0d5c8;
  margin: 0 4px;
  vertical-align: middle;
}

/* ---- 编辑器 Tab 切换（问题3） ---- */
.editor-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid #e8ddd0;
  margin-bottom: 0;
}
.editor-tab {
  padding: 9px 22px;
  font-size: 13px;
  font-weight: 500;
  color: #a09080;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  transition: all 0.2s;
  -webkit-transition: all 0.2s;
  font-family: inherit;
}
.editor-tab:hover {
  color: #8b7355;
}
.editor-tab.active {
  color: #8b7355;
  border-bottom-color: #8b7355;
  font-weight: 600;
}

/* ---- 预览区域（问题3） ---- */
.content-preview-area {
  border: 1px solid #e8ddd0;
  border-top: none;
  border-radius: 0 0 6px 6px;
  padding: 24px;
  min-height: 300px;
  max-height: 600px;
  overflow-y: auto;
  background: #fff;
  font-size: 15px;
  line-height: 1.8;
  color: #4a3f35;
  word-wrap: break-word;
}
.content-preview-area img {
  max-width: 100%;
  border-radius: 8px;
  margin: 8px 0;
}
.content-preview-area h1 { font-size: 24px; margin: 16px 0 8px; }
.content-preview-area h2 { font-size: 20px; margin: 14px 0 8px; }
.content-preview-area h3 { font-size: 17px; margin: 12px 0 6px; }
.content-preview-area p { margin: 8px 0; }
.content-preview-area blockquote {
  border-left: 4px solid #8b7355;
  background: #faf7f2;
  padding: 12px 16px;
  margin: 12px 0;
  border-radius: 0 6px 6px 0;
}
.content-preview-area pre {
  background: #f0ebe3;
  padding: 14px;
  border-radius: 6px;
  overflow-x: auto;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}
.content-preview-area code {
  background: #f0ebe3;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'Courier New', Consolas, monospace;
  font-size: 13px;
}
.content-preview-area ul, .content-preview-area ol {
  padding-left: 24px;
  margin: 8px 0;
}
.content-preview-area li { margin: 4px 0; }
.content-preview-area table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
}
.content-preview-area th, .content-preview-area td {
  border: 1px solid #e8ddd0;
  padding: 8px 12px;
  text-align: left;
}
.content-preview-area th {
  background: #faf8f5;
  font-weight: 600;
}
.content-preview-area hr {
  border: none;
  border-top: 1px solid #e8ddd0;
  margin: 16px 0;
}
.content-preview-area a { color: #8b7355; text-decoration: underline; }
.preview-empty-hint {
  text-align: center;
  color: #c0b0a0;
  padding: 60px 20px;
  font-size: 14px;
}

/* ---- AList 图片链接行 ---- */
.alist-image-row {
  margin-bottom: 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
  padding: 8px;
  background: #fdf9f3;
  border: 1px dashed #d9c6a8;
  border-radius: 8px;
}
.alist-image-row .form-input {
  flex: 1;
  font-size: 13px;
}
.alist-image-row .btn {
  flex-shrink: 0;
}

/* ---- 外链图片行 ---- */
.external-image-row {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  align-items: center;
}
.external-image-row .form-input {
  flex: 1;
  font-size: 13px;
}

/* ================================================================
   v9 移动端后台全面适配
   ================================================================ */

/* ---- 移动端汉堡按钮（默认隐藏，移动端显示） ---- */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 2001;
  background: #fff;
  border: 1px solid #e8ddd0;
  border-radius: 8px;
  padding: 8px 10px;
  color: #6b5b4f;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  line-height: 1;
  transition: background 0.2s;
}
.mobile-menu-btn:hover {
  background: #f5f0e8;
}
.mobile-menu-btn svg {
  display: block;
}

/* ---- 移动端关闭按钮（默认隐藏） ---- */
.sidebar-close-btn {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  color: #a09080;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  border-radius: 4px;
  transition: background 0.2s;
}
.sidebar-close-btn:hover {
  background: rgba(0,0,0,0.05);
  color: #4a3f35;
}

/* ---- 遮罩层 ---- */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.45);
  z-index: 2000;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.sidebar-overlay.show {
  display: block;
}

/* ---- 移动端：侧边栏变为抽屉 ---- */
@media screen and (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .sidebar-close-btn {
    display: block;
  }

  .admin-sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    z-index: 2001;
    width: 280px !important;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    -webkit-transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .admin-sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.2);
  }
  /* 桌面端的折叠类在移动端不生效 */
  .admin-sidebar.sidebar-collapsed {
    transform: translateX(-100%);
  }
  .admin-sidebar.sidebar-collapsed.sidebar-open {
    transform: translateX(0);
  }

  /* 侧边栏内部样式修正 */
  .admin-sidebar .sidebar-header {
    padding: 16px 16px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .admin-sidebar .sidebar-logo {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  .admin-sidebar .sidebar-title {
    font-size: 15px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .admin-sidebar .sidebar-toggle-btn {
    display: none;
  }
  .admin-sidebar .nav-item {
    padding: 13px 20px;
    font-size: 14px;
    white-space: nowrap;
  }
  .admin-sidebar .nav-item .icon {
    font-size: 16px;
    width: 24px;
    margin-right: 10px;
  }
  .admin-sidebar .sidebar-footer {
    padding: 12px 20px;
  }

  /* 主内容区全宽 */
  .admin-main {
    width: 100% !important;
    min-width: 0 !important;
    padding-top: 50px; /* 给汉堡按钮留空间 */
  }

  /* 顶部 header */
  .admin-header {
    padding: 14px 16px 14px 52px; /* 左侧留出汉堡按钮位置 */
    gap: 10px;
    flex-wrap: wrap;
  }
  .admin-header h1,
  .admin-header .page-title {
    font-size: 17px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .admin-header .btn-primary,
  .admin-header .btn {
    font-size: 13px;
    padding: 7px 14px;
    white-space: nowrap;
    flex-shrink: 0;
  }

  /* 内容区 */
  .admin-content {
    padding: 16px 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ---- 表格横向滚动 ---- */
@media screen and (max-width: 768px) {
  .admin-content table,
  .data-table {
    min-width: 600px;
    font-size: 12px;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
  .data-table th,
  .data-table td {
    padding: 10px 10px;
  }
  /* 文章管理表格标题允许换行 */
  .posts-table td:nth-child(2) {
    white-space: normal;
    min-width: 140px;
    max-width: 220px;
  }
  /* 类型列（emoji+文字）不换行 */
  .posts-table td:nth-child(3) {
    white-space: nowrap;
  }
}

/* ---- 回收站表格防压扁 ---- */
.trash-table .type-narrow {
  white-space: nowrap;
  min-width: 70px;
}
.trash-table .num-col {
  text-align: center;
  white-space: nowrap;
}
.trash-table .tags-col .tag-label {
  white-space: nowrap;
}
@media screen and (max-width: 768px) {
  .trash-table { font-size: 12px; }
  .trash-table th,
  .trash-table td { padding: 8px 6px; }
}
  /* 表格操作按钮缩小 */
  .data-table .btn-sm {
    padding: 4px 8px;
    font-size: 11px;
  }
}

/* ---- 表单自适应 ---- */
@media screen and (max-width: 768px) {
  .form-group input[type="text"],
  .form-group input[type="password"],
  .form-group input[type="email"],
  .form-group input[type="number"],
  .form-group input[type="url"],
  .form-group input[type="datetime-local"],
  .form-group select,
  .form-group textarea {
    font-size: 16px; /* 防止 iOS 自动缩放 */
    padding: 12px 14px;
    width: 100%;
    box-sizing: border-box;
  }
  .form-input {
    font-size: 16px;
    padding: 10px 12px;
    width: 100%;
    box-sizing: border-box;
  }
  .form-group label {
    font-size: 14px;
    margin-bottom: 6px;
    display: block;
  }
  .form-group {
    margin-bottom: 16px;
  }
  /* 编辑页多列布局改为单列 */
  .edit-form > div[style*="display:flex"],
  .edit-form > div[style*="display: flex"] {
    flex-direction: column !important;
    gap: 0 !important;
  }
  .edit-form > div[style*="display:flex"] > .form-group,
  .edit-form > div[style*="display: flex"] > .form-group {
    min-width: 100% !important;
    width: 100% !important;
  }
}

/* ---- 图片预览列表自适应 ---- */
@media screen and (max-width: 768px) {
  .image-preview-item {
    width: 100px;
    height: 100px;
    margin: 0 4px 8px;
  }
  .image-upload-area {
    padding: 24px 16px;
    font-size: 13px;
  }
  .image-upload-area .upload-icon {
    font-size: 28px;
  }
}

/* ---- 外链图片行自适应 ---- */
@media screen and (max-width: 768px) {
  .external-image-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .external-image-row .form-input {
    width: 100%;
    flex: none;
  }
  .external-image-row .btn {
    width: 100%;
    text-align: center;
  }
}

/* ---- 编辑器工具栏自适应 ---- */
@media screen and (max-width: 768px) {
  .html-editor-toolbar {
    padding: 6px;
    gap: 2px;
    flex-wrap: wrap;
  }
  .html-editor-toolbar .editor-btn,
  .html-editor-toolbar .ed-btn,
  .html-editor-toolbar button {
    min-width: 28px;
    height: 28px;
    padding: 0 5px;
    font-size: 12px;
  }
  .editor-separator,
  .html-editor-toolbar .ed-divider {
    margin: 0 2px;
    height: 18px;
  }
  .editor-tab {
    padding: 8px 14px;
    font-size: 12px;
  }
  .content-preview-area {
    padding: 16px;
    min-height: 200px;
    font-size: 14px;
  }
  /* 编辑器 textarea */
  .html-editor-toolbar + textarea,
  .editor-textarea {
    font-size: 16px;
    min-height: 200px;
  }
}

/* ---- 设置页面自适应 ---- */
@media screen and (max-width: 768px) {
  .settings-section {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
  }
  .settings-section h3 {
    font-size: 15px;
    margin-bottom: 12px;
  }
  .settings-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 0;
  }
  .settings-col {
    min-width: 100%;
    width: 100%;
  }
  .color-grid {
    gap: 10px;
    grid-template-columns: 1fr 1fr;
  }
  .color-item .color-text {
    width: 80px;
    font-size: 11px;
  }
  .color-input-group {
    flex-wrap: wrap;
    gap: 6px;
  }
  .color-input-group input[type="text"] {
    width: 100px;
    font-size: 13px;
  }
  .color-input-group input[type="color"] {
    width: 36px;
    height: 36px;
  }
  .preview-box {
    max-height: 150px;
    overflow: hidden;
  }
  /* 主题设置中的范围选择器 */
  .settings-section input[type="range"] {
    width: 100%;
  }
  /* 主题设置中的 select */
  .settings-section select {
    width: 100%;
    font-size: 16px;
    padding: 10px 12px;
  }
}

/* ---- 统计卡片自适应 ---- */
@media screen and (max-width: 768px) {
  .stats-cards {
    margin: 0 -4px 16px;
    flex-wrap: wrap;
  }
  .stat-card {
    width: 50%;
    padding: 0 4px;
    margin-bottom: 8px;
  }
  .stat-card-inner {
    padding: 14px 10px;
  }
  .stat-number {
    font-size: 22px;
  }
  .stat-label {
    font-size: 11px;
  }
  .stat-icon svg {
    width: 26px;
    height: 26px;
  }
}

/* ---- 按钮自适应 ---- */
@media screen and (max-width: 768px) {
  .btn {
    padding: 9px 14px;
    font-size: 13px;
    touch-action: manipulation;
  }
  .btn-lg {
    padding: 12px 20px;
    font-size: 14px;
    width: 100%;
    text-align: center;
  }
  .btn-sm {
    padding: 5px 10px;
    font-size: 11px;
  }
  .form-actions {
    margin-top: 16px;
    padding-top: 14px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .form-actions .btn {
    flex: 1;
    min-width: 120px;
    text-align: center;
  }
  .quick-actions {
    flex-wrap: wrap;
    gap: 8px;
  }
  .quick-actions .btn {
    flex: 1;
    min-width: 100px;
    text-align: center;
    margin-right: 0;
  }
}

/* ---- Alert 自适应 ---- */
@media screen and (max-width: 768px) {
  .alert {
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 14px;
    word-break: break-word;
  }
}

/* ---- Modal 自适应 ---- */
@media screen and (max-width: 768px) {
  .modal,
  .admin-modal {
    width: 95% !important;
    max-width: none !important;
    margin: 10px auto;
  }
  .modal-body,
  .admin-modal-body {
    padding: 16px;
  }
  .modal-footer,
  .admin-modal-footer {
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .modal-footer .btn,
  .admin-modal-footer .btn {
    flex: 1;
    min-width: 0;
    text-align: center;
  }
}

/* ---- 标签建议自适应 ---- */
@media screen and (max-width: 768px) {
  .tag-suggestion {
    padding: 5px 10px;
    font-size: 13px;
    margin: 0 4px 6px 0;
  }
}

/* ---- 分页自适应 ---- */
@media screen and (max-width: 768px) {
  .pagination {
    flex-wrap: wrap;
    gap: 3px;
    justify-content: center;
  }
  .pagination a,
  .pagination span {
    padding: 7px 11px;
    font-size: 12px;
    min-width: 34px;
    text-align: center;
  }
}

/* ---- 超小屏幕（< 480px）进一步优化 ---- */
@media screen and (max-width: 480px) {
  .admin-header {
    padding: 10px 12px 10px 48px;
  }
  .admin-header h1,
  .admin-header .page-title {
    font-size: 15px;
  }
  .admin-content {
    padding: 12px 10px;
  }
  .stat-card {
    width: 100%;
  }
  .settings-section {
    padding: 14px 12px;
  }
  .settings-section h3 {
    font-size: 14px;
  }
  .image-preview-item {
    width: 80px;
    height: 80px;
    margin: 0 3px 6px;
  }
  .data-table {
    min-width: 500px;
  }
  .color-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- 平板适配（769px - 1024px） ---- */
@media screen and (min-width: 769px) and (max-width: 1024px) {
  .admin-sidebar {
    width: 200px;
  }
  .admin-sidebar .nav-item {
    padding: 11px 14px;
    font-size: 13px;
  }
  .admin-sidebar .sidebar-title {
    font-size: 13px;
  }
  .admin-main {
    padding: 20px;
  }
  .settings-section {
    padding: 18px;
  }
  .color-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ---- 确保移动端点击区域足够大 ---- */
@media screen and (max-width: 768px) {
  .admin-sidebar .nav-item,
  .sidebar-nav a {
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .data-table .btn-sm,
  .data-table .btn-xs {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
  }
}

/* ---- 移动端隐藏桌面端折叠按钮 ---- */
@media screen and (max-width: 768px) {
  #sidebarToggleBtn {
    display: none !important;
  }
}

/* ---- 数据管理页面导入表单 ---- */
@media screen and (max-width: 768px) {
  .import-section input[type="file"] {
    font-size: 14px;
    width: 100%;
  }
  .import-section .btn {
    width: 100%;
    margin-top: 8px;
  }
}

/* ---- 账号安全页面 ---- */
@media screen and (max-width: 768px) {
  .security-section {
    padding: 16px;
    margin-bottom: 16px;
  }
  .security-section h3 {
    font-size: 15px;
  }
}

/* ---- 文章编辑页封面选择 ---- */
@media screen and (max-width: 768px) {
  .cover-preview {
    max-width: 100%;
    height: auto;
  }
  .cover-select-area {
    flex-direction: column;
  }
}