:root {
  --bg: #f3f6fb;
  --bg-soft: #ffffff;
  --panel: #ffffff;
  --line: #d9e1ec;
  --text: #1f2a37;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-2: #1d4ed8;
  --danger: #dc2626;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f8fafc, #eef3f9 100%);
}

.login-page-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

button,
input,
textarea,
select {
  font: inherit;
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fbff, #f1f5f9);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 34px;
}

.brand-logo {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), #60a5fa);
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.2);
}

.brand-title {
  font-size: 22px;
  font-weight: 700;
}

.brand-subtitle,
.muted,
.sidebar-foot {
  color: var(--muted);
}

.side-nav {
  display: grid;
  gap: 12px;
}

.nav-link,
.ghost-btn,
.primary-btn {
  border: 0;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.nav-link {
  padding: 14px 16px;
  text-align: left;
  color: var(--text);
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--line);
}

.nav-link.active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

.sidebar-foot {
  margin-top: 28px;
  font-size: 13px;
  line-height: 1.7;
}

.main-panel {
  padding: 28px;
}

.login-card,
.panel,
.card {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

.login-card {
  max-width: 620px;
  margin: 80px auto 0;
  padding: 28px;
  border-radius: 28px;
}

.standalone-login-card {
  width: min(620px, 100%);
  margin: 0;
}

.auth-brand {
  margin-bottom: 22px;
}

.full-width-btn {
  width: 100%;
}

.panel {
  border-radius: 30px;
  padding: 28px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

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

.section-title,
.card-title {
  font-size: 24px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.full {
  grid-column: 1 / -1;
}

label span {
  display: block;
  margin-bottom: 10px;
  color: #334155;
}

.field-label {
  display: block;
  margin-bottom: 10px;
  color: #334155;
}

input,
textarea,
select {
  width: 100%;
  border-radius: 14px;
  border: 1px solid #d5deea;
  padding: 14px 16px;
  color: var(--text);
  background: #ffffff;
  outline: none;
}

textarea {
  resize: vertical;
}

.primary-btn {
  padding: 14px 20px;
  border-radius: 14px;
  color: #ffffff;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.ghost-btn {
  padding: 12px 18px;
  border-radius: 14px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
}

.primary-btn:hover,
.ghost-btn:hover,
.nav-link:hover {
  transform: translateY(-1px);
}

.notice {
  min-height: 24px;
  margin-top: 14px;
  color: #2563eb;
}

.remember-row {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.remember-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.hidden {
  display: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #f8fbff);
}

.stat-value {
  margin-top: 12px;
  font-size: 30px;
  font-weight: 800;
  color: var(--accent);
}

.split-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
}

.card {
  border-radius: 24px;
  padding: 22px;
}

.stack-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.lead-card {
  margin-top: 18px;
}

.config-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid #e5e7eb;
}

.home-config-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 20px;
  margin-top: 22px;
}

.home-config-list-panel,
.home-config-editor-panel {
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  background: #f8fafc;
  padding: 18px;
  min-height: 520px;
}

.home-config-list-head {
  margin-bottom: 14px;
}

.home-config-list {
  display: grid;
  gap: 12px;
}

.home-config-group {
  display: grid;
  gap: 10px;
}

.home-config-group-title {
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
}

.home-config-item {
  width: 100%;
  text-align: left;
  border: 1px solid #dbe3ef;
  border-radius: 16px;
  background: #ffffff;
  padding: 14px;
  cursor: pointer;
}

.home-config-item.is-active {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.14);
}

.home-config-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.home-config-item-title {
  font-weight: 700;
  color: #0f172a;
}

.home-config-item-meta {
  margin-top: 6px;
  font-size: 13px;
  color: #64748b;
}

.home-config-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.home-config-editor-empty {
  min-height: 320px;
  display: grid;
  place-items: center;
  color: #64748b;
  text-align: center;
}

.editor-form-grid {
  display: grid;
  gap: 18px;
}

.editor-form-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-panel-title {
  font-size: 22px;
  font-weight: 700;
}

.editor-panel-subtitle {
  margin-top: 6px;
  color: #64748b;
}

.field-hint {
  margin-top: 6px;
  font-size: 12px;
  color: #64748b;
}

@media (max-width: 1100px) {
  .home-config-shell {
    grid-template-columns: 1fr;
  }

  .home-config-editor-panel {
    min-height: 0;
  }
}

.config-grid {
  display: grid;
  gap: 18px;
  margin-top: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.config-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.config-preview {
  margin-top: 12px;
}

.config-thumb {
  width: 100%;
  margin-top: 12px;
  max-height: 180px;
  border-radius: 14px;
  object-fit: cover;
  border: 1px solid #dbe3ef;
  background: #fff;
}

.config-thumb-large {
  max-width: 320px;
  max-height: 180px;
}

.config-thumb-feature {
  width: min(320px, 100%);
  aspect-ratio: 29 / 22;
  max-height: none;
}

.list-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.list-item.is-dragging {
  opacity: 0.55;
  border-style: dashed;
}

.list-item.is-drop-target {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.14);
}

.list-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.drag-hint {
  color: var(--muted);
  font-size: 13px;
  cursor: grab;
  user-select: none;
}

.toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #334155;
  margin-top: 2px;
}

.toggle-line input {
  width: 18px;
  height: 18px;
}

.badge {
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--accent);
  border: 1px solid var(--line);
  background: #eff6ff;
}

.button-row,
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
}

.draft-bar {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cover-manager,
.editor-toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.embed-helper {
  padding: 14px;
  border-top: 1px solid #e2e8f0;
  background: #fcfdff;
}

.embed-helper-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.embed-helper textarea {
  margin-top: 12px;
  min-height: 88px;
}

.embed-helper-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.embed-helper-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.preview-embed-card {
  margin: 14px 0;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid #dbeafe;
  background: #f8fbff;
}

.preview-embed-title {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.preview-inline-video {
  display: block;
  width: 100%;
  max-height: 320px;
  border-radius: 12px;
  background: #020617;
}

.video-selection {
  margin-top: 12px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid #dbeafe;
  background: #f8fbff;
}

.video-selection-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.video-selection-name {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  word-break: break-all;
}

.video-selection-meta {
  font-size: 12px;
  color: #64748b;
}

.video-selection-preview {
  display: block;
  width: 100%;
  max-height: 260px;
  margin-top: 12px;
  border-radius: 12px;
  background: #020617;
}

.video-selection-actions {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.upload-progress {
  margin-top: 12px;
}

.upload-progress-track {
  height: 8px;
  border-radius: 999px;
  background: #dbeafe;
  overflow: hidden;
}

.upload-progress-bar {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(135deg, #0ea5e9, #38bdf8);
  transition: width 0.2s ease;
}

.upload-progress-text {
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
}

.editor-embed-placeholder {
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px dashed #7dd3fc;
  background: linear-gradient(135deg, #effbff, #f8fbff);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.85);
}

.editor-embed-badge {
  display: inline-flex;
  min-height: 24px;
  padding: 0 10px;
  align-items: center;
  border-radius: 999px;
  background: #dff7ff;
  color: #0b6f93;
  font-size: 12px;
  font-weight: 700;
}

.editor-embed-title {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.editor-embed-meta {
  margin-top: 6px;
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
  word-break: break-all;
}

.editor-shell {
  border: 1px solid #dbe3ef;
  border-radius: 20px;
  background: #ffffff;
  overflow: hidden;
}

.editor-topbar,
.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.editor-footer {
  border-top: 1px solid #e2e8f0;
  border-bottom: 0;
}

.editor-mode-tabs {
  display: flex;
  gap: 10px;
}

.editor-mode-btn {
  padding: 10px 14px;
}

.editor-mode-active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

.editor-toolbar .ghost-btn.is-active {
  color: #ffffff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
}

.table-action-btn.is-disabled {
  opacity: 0.45;
}

.ghost-btn.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.rich-editor table.is-selected {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
}

.editor-status {
  font-size: 13px;
  color: var(--muted);
}

.editor-toolbar {
  padding: 14px;
}

.editor-select {
  min-width: 130px;
  width: auto;
}

.cover-preview {
  margin-top: 12px;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f8fafc;
  aspect-ratio: 16 / 9;
}

.cover-preview img,
#previewCoverImage {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rich-editor {
  min-height: 320px;
  padding: 16px;
  background: transparent;
  outline: none;
  line-height: 1.8;
}

.source-editor {
  min-height: 320px;
  padding: 16px;
  border: 0;
  resize: vertical;
  border-radius: 0;
  background: transparent;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.7;
}

.rich-editor h2,
.preview-body h2 {
  margin: 18px 0 10px;
  font-size: 24px;
}

.rich-editor h3,
.preview-body h3 {
  margin: 16px 0 8px;
  font-size: 20px;
}

.rich-editor p,
.preview-body p {
  margin: 10px 0;
}

.rich-editor ul,
.preview-body ul {
  padding-left: 20px;
}

.rich-editor ol,
.preview-body ol {
  padding-left: 20px;
}

.rich-editor img,
.preview-body img {
  max-width: 100%;
  border-radius: 16px;
}

.rich-editor table,
.preview-body table,
.detail-body table {
  width: 100%;
  margin: 18px 0;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 12px;
}

.rich-editor td,
.rich-editor th,
.preview-body td,
.preview-body th,
.detail-body td,
.detail-body th {
  padding: 10px 12px;
  border: 1px solid #dbe3ef;
}

.rich-editor th,
.preview-body th,
.detail-body th {
  background: #eff6ff;
}

.rich-editor blockquote,
.preview-body blockquote {
  margin: 14px 0;
  padding: 10px 14px;
  border-left: 4px solid #93c5fd;
  background: #eff6ff;
  color: #334155;
}

.rich-editor hr,
.preview-body hr {
  margin: 18px 0;
  border: 0;
  border-top: 1px solid #dbe3ef;
}

.preview-panel {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #e2e8f0;
}

.admin-user-shell {
  margin-top: 20px;
  align-items: start;
}

.inner-card {
  border-radius: 22px;
}

.small-title {
  font-size: 18px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.status-pill-on {
  color: #166534;
  background: #dcfce7;
}

.status-pill-off {
  color: #991b1b;
  background: #fee2e2;
}

.article-preview-card {
  margin-top: 18px;
  padding: 22px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.preview-title {
  margin-top: 16px;
  font-size: 28px;
  font-weight: 800;
}

.preview-summary {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.7;
}

.preview-body {
  margin-top: 16px;
  line-height: 1.8;
}

.table-wrap {
  margin-top: 18px;
  overflow: auto;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  padding: 32px;
  background: rgba(15, 23, 42, 0.22);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay.hidden {
  display: none;
}

.modal-card {
  width: min(1100px, 100%);
  max-height: calc(100vh - 64px);
  overflow: auto;
  border-radius: 28px;
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
  padding: 24px;
}

.auth-modal-card {
  width: min(520px, 100%);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.detail-modal-card {
  width: min(900px, 100%);
}

.detail-cover-image {
  margin-top: 18px;
  width: 100%;
  border-radius: 20px;
  max-height: 280px;
  object-fit: cover;
}

.detail-body {
  padding-bottom: 8px;
}

.cropper-layout {
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 280px;
  gap: 20px;
}

.crop-stage-wrap {
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid rgba(123, 232, 255, 0.12);
  background:
    linear-gradient(45deg, rgba(255,255,255,0.02) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.02) 75%),
    linear-gradient(45deg, rgba(255,255,255,0.02) 25%, transparent 25%, transparent 75%, rgba(255,255,255,0.02) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
}

.cropper-canvas {
  width: 100%;
  display: block;
  aspect-ratio: 16 / 9;
}

.crop-controls {
  display: grid;
  gap: 18px;
}

.cropper-tip {
  border-radius: 16px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.5;
}

.crop-controls label span {
  display: block;
  margin-bottom: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid #e5e7eb;
}

th {
  color: #64748b;
  font-weight: 600;
}

.action-inline {
  display: flex;
  gap: 10px;
}

.mini-user-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
}

.mini-user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
  border: 1px solid #dbe3ef;
  background: #f8fbff;
}

.mini-user-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #4be6ff, #0b6f93);
  color: #03141f;
  font-weight: 700;
}

.danger-link,
.text-link {
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
}

.text-link {
  color: var(--accent);
}

.danger-link {
  color: var(--danger);
}

@media (max-width: 1100px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stats-grid,
  .split-grid,
  .two-col,
  .cropper-layout {
    grid-template-columns: 1fr;
  }

  .overlay {
    padding: 16px;
  }

  .embed-helper-grid {
    grid-template-columns: 1fr;
  }
}
