/* ============================================================
   吃土皮皮虎 · 后台管理
   ============================================================ */

.admin-body {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

/* --------------------------------- 侧边栏 --------------------------------- */
.aside {
  width: 216px;
  flex-shrink: 0;
  background: var(--bg-elevated);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  transition: transform 0.25s var(--ease);
}
.aside-brand {
  height: 58px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.aside-nav {
  flex: 1;
  padding: 14px 12px;
  overflow-y: auto;
}
.aside-group {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-tertiary);
  letter-spacing: 0.6px;
  padding: 12px 10px 7px;
  text-transform: uppercase;
}
.aside-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 9px;
  font-size: 14.2px;
  color: var(--text-secondary);
  margin-bottom: 2px;
  transition: all 0.15s var(--ease);
}
.aside-link:hover {
  background: var(--bg-subtle);
  color: var(--text);
}
.aside-link.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.aside-link svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
.aside-link .count {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-tertiary);
  background: var(--bg-subtle);
  padding: 1px 7px;
  border-radius: 9px;
}
.aside-foot {
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* --------------------------------- 主区域 --------------------------------- */
.admin-main {
  flex: 1;
  margin-left: 216px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.admin-top {
  height: 58px;
  background: color-mix(in srgb, var(--bg-elevated) 90%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  position: sticky;
  top: 0;
  z-index: 40;
}
.admin-top h1 {
  font-size: 16.5px;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-content {
  padding: 22px;
  flex: 1;
}
.aside-toggle {
  display: none;
}

/* --------------------------------- 卡片 --------------------------------- */
.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 18px;
}
.card + .card {
  margin-top: 16px;
}
.card-title {
  font-size: 14.5px;
  font-weight: 700;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 17px 18px;
}
.stat-card .label {
  font-size: 12.5px;
  color: var(--text-tertiary);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.stat-card .label svg {
  width: 14px;
  height: 14px;
}
.stat-card .value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.6px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat-card .sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 5px;
}

/* --------------------------------- 表单 --------------------------------- */
.field {
  margin-bottom: 15px;
}
.field label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.field label .hint {
  font-weight: 400;
  font-size: 11.5px;
  color: var(--text-tertiary);
}
.input,
.textarea,
.select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--bg);
  font-size: 14px;
  outline: none;
  transition: all 0.15s var(--ease);
  font-family: inherit;
}
.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--bg-elevated);
}
.textarea {
  resize: vertical;
  line-height: 1.7;
  min-height: 76px;
}
.select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239aa0a8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 32px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.switch {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text-secondary);
  user-select: none;
}
.switch input {
  appearance: none;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background 0.2s var(--ease);
  flex-shrink: 0;
}
.switch input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s var(--ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.switch input:checked {
  background: var(--accent);
}
.switch input:checked::after {
  transform: translateX(16px);
}
.counter {
  font-size: 11.5px;
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}
.counter.warn {
  color: #e6a23c;
}
.counter.over {
  color: #f04438;
  font-weight: 600;
}

/* --------------------------------- 表格 --------------------------------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.table th {
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-tertiary);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:hover {
  background: var(--bg-subtle);
}
.table tbody tr:last-child td {
  border-bottom: none;
}
.table-title {
  font-weight: 600;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 3px;
}
.table-title:hover {
  color: var(--accent);
}
.table-sub {
  font-size: 12px;
  color: var(--text-tertiary);
}
.table-thumb {
  width: 58px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-subtle);
  flex-shrink: 0;
}
.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.act {
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12.5px;
  color: var(--text-secondary);
  background: var(--bg-subtle);
  transition: all 0.15s var(--ease);
  white-space: nowrap;
}
.act:hover {
  background: var(--bg-hover);
  color: var(--text);
}
.act-danger:hover {
  background: rgba(240, 68, 56, 0.12);
  color: #f04438;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.toolbar .input {
  width: auto;
  min-width: 200px;
  flex: 1;
  max-width: 320px;
}
.seg {
  display: inline-flex;
  background: var(--bg-subtle);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
}
.seg a {
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--text-secondary);
  transition: all 0.15s var(--ease);
}
.seg a.active {
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

/* ------------------------------ 长图文编辑器 ------------------------------ */
.editor-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}
.editor-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.title-input {
  width: 100%;
  padding: 18px 20px 12px;
  border: none;
  background: none;
  font-size: 22px;
  font-weight: 700;
  outline: none;
  letter-spacing: -0.4px;
}
.title-input::placeholder {
  color: var(--text-tertiary);
  font-weight: 600;
}
.md-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 7px 12px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
}
.md-btn {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: var(--text-secondary);
  font-size: 13px;
  transition: all 0.15s var(--ease);
}
.md-btn:hover {
  background: var(--bg-hover);
  color: var(--accent);
}
.md-btn svg {
  width: 15px;
  height: 15px;
}
.md-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 5px;
}
.md-spacer {
  flex: 1;
}
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 520px;
}
.split.no-preview {
  grid-template-columns: 1fr;
}
.split.no-preview .preview-pane {
  display: none;
}
.md-input {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  padding: 18px 20px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.85;
  background: none;
  color: var(--text);
  min-height: 520px;
}
.preview-pane {
  border-left: 1px solid var(--border);
  padding: 18px 22px;
  overflow-y: auto;
  max-height: 78vh;
  background: var(--bg);
}
.preview-pane .prose {
  font-size: 15px;
}
.editor-status {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-tertiary);
  background: var(--bg);
  flex-wrap: wrap;
}
.side-panel {
  position: sticky;
  top: 74px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ------------------------------ 笔记编辑器 ------------------------------ */
.img-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
}
.img-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 9px;
  overflow: hidden;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  cursor: grab;
}
.img-item.dragging {
  opacity: 0.4;
}
.img-item.drag-over {
  border-color: var(--accent);
  border-width: 2px;
}
.img-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.img-item .idx {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  font-size: 11px;
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
}
.img-item .cover-flag {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(244, 81, 30, 0.9);
  color: #fff;
  font-size: 10.5px;
  text-align: center;
  padding: 2px;
}
.img-item .del {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 14px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s var(--ease);
  backdrop-filter: blur(4px);
}
.img-item:hover .del {
  opacity: 1;
}
.img-add {
  aspect-ratio: 1;
  border: 1.5px dashed var(--border-strong);
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--text-tertiary);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  text-align: center;
  gap: 4px;
  padding: 8px;
}
.img-add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}
.img-add svg {
  width: 20px;
  height: 20px;
}
.dropzone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  padding: 26px;
  text-align: center;
  color: var(--text-tertiary);
  font-size: 13.5px;
  transition: all 0.15s var(--ease);
  cursor: pointer;
}
.dropzone.over {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.note-text-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--bg);
  outline: none;
  resize: vertical;
  font-size: 15px;
  line-height: 1.75;
  min-height: 180px;
  font-family: inherit;
}
.note-text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* --------------------------------- 提示 --------------------------------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #17181a;
  color: #fff;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: all 0.24s var(--ease);
  max-width: 86vw;
}
html[data-theme='dark'] .toast {
  background: #2a2d33;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.error {
  background: #d92d20;
}
.toast.success {
  background: #12a150;
}
.import-float {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #17181a;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: all .24s var(--ease);
}
html[data-theme='dark'] .import-float { background: #2a2d33; }
.import-float.show { opacity: 1; transform: translateY(0); }
.import-float.success { background: #12a150; }
.import-float.error { background: #d92d20; }
.import-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ctpph-spin .7s linear infinite;
  flex: none;
}
@keyframes ctpph-spin { to { transform: rotate(360deg); } }

.alert {
  padding: 12px 15px;
  border-radius: 10px;
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.alert-warn {
  background: rgba(230, 162, 60, 0.12);
  color: #b8860b;
  border: 1px solid rgba(230, 162, 60, 0.3);
}
html[data-theme='dark'] .alert-warn {
  color: #e6a23c;
}
.alert-info {
  background: var(--accent-soft);
  color: var(--accent);
}

/* --------------------------------- 登录页 -------------------------------- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 366px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 34px 30px;
  box-shadow: var(--shadow-md);
}
.login-logo {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  background: linear-gradient(135deg, var(--accent), #ff8f4d);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 23px;
  font-weight: 800;
  margin: 0 auto 16px;
  box-shadow: 0 4px 14px rgba(244, 81, 30, 0.35);
}
.login-card h1 {
  font-size: 19px;
  text-align: center;
  margin-bottom: 5px;
}
.login-card p.sub {
  font-size: 13px;
  color: var(--text-tertiary);
  text-align: center;
  margin-bottom: 24px;
}
.login-error {
  background: rgba(240, 68, 56, 0.1);
  color: #f04438;
  padding: 9px 13px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 15px;
  text-align: center;
}

/* --------------------------------- 笔记卡片网格 --------------------------------- */
.admin-note-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(178px, 1fr));
  gap: 14px;
}
.admin-note-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 11px;
  overflow: hidden;
  transition: all 0.18s var(--ease);
}
.admin-note-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.admin-note-card .thumb {
  aspect-ratio: 3 / 4;
  background: var(--bg-subtle);
  position: relative;
  display: block;
}
.admin-note-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.admin-note-card .thumb .ph {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--text-tertiary);
  font-size: 12px;
}
.admin-note-card .body {
  padding: 10px 11px 11px;
}
.admin-note-card .t {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 7px;
  min-height: 39px;
}
.admin-note-card .m {
  font-size: 11.5px;
  color: var(--text-tertiary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 9px;
}
.admin-note-card .acts {
  display: flex;
  gap: 6px;
}
.admin-note-card .acts a,
.admin-note-card .acts button {
  flex: 1;
  text-align: center;
  padding: 5px;
  border-radius: 6px;
  font-size: 12px;
  background: var(--bg-subtle);
  color: var(--text-secondary);
}
.admin-note-card .acts a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.admin-note-card .acts button:hover {
  background: rgba(240, 68, 56, 0.12);
  color: #f04438;
}

/* --------------------------------- 响应式 -------------------------------- */
@media (max-width: 1100px) {
  .editor-wrap {
    grid-template-columns: 1fr;
  }
  .side-panel {
    position: static;
  }
  .split {
    grid-template-columns: 1fr;
  }
  .preview-pane {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 460px;
  }
  .split.mobile-edit .preview-pane {
    display: none;
  }
}

@media (max-width: 860px) {
  .aside {
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  .aside.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
  }
  .aside-toggle {
    display: grid;
  }
  .admin-content {
    padding: 15px;
  }
  .admin-top {
    padding: 0 15px;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .aside-mask {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 45;
    display: none;
  }
  .aside-mask.show {
    display: block;
  }
  .table th:nth-child(3),
  .table td:nth-child(3),
  .table th:nth-child(4),
  .table td:nth-child(4) {
    display: none;
  }
  .title-input {
    font-size: 19px;
    padding: 15px 16px 10px;
  }
  .md-input {
    padding: 14px 16px;
    min-height: 380px;
  }
}

/* ============================================================
   追加：状态徽标 / 标签胶囊 / 仪表盘 / 批量条 / 分类编辑
   ============================================================ */
.badge-pub {
  background: rgba(18, 161, 80, 0.13);
  color: #12a150;
}
.badge-draft {
  background: var(--bg-subtle);
  color: var(--text-tertiary);
}
.badge-pin {
  background: var(--accent-soft);
  color: var(--accent);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 20px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-secondary);
}
.pill b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.dash-grid .card {
  margin-top: 0;
}

.mini-list {
  display: flex;
  flex-direction: column;
}
.mini-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.mini-row:last-child {
  border-bottom: none;
}
.mini-thumb {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg-subtle);
  flex-shrink: 0;
}
.mini-main {
  flex: 1;
  min-width: 0;
}
.mini-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mini-title:hover {
  color: var(--accent);
}
.mini-sub {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 3px;
}
.mini-side {
  font-size: 12px;
  color: var(--text-tertiary);
  flex-shrink: 0;
  text-align: right;
  white-space: nowrap;
}

.batch-bar {
  position: sticky;
  bottom: 16px;
  display: none;
  align-items: center;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  margin-top: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 30;
}
.batch-bar.show {
  display: flex;
}
.batch-bar #batchCount {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.batch-bar .acts {
  display: flex;
  gap: 8px;
  margin-left: auto;
  flex-wrap: wrap;
}

/* ------------------------------ 确认弹窗（单例） ------------------------------ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  z-index: 1000;
  padding: 20px;
  animation: ctpphFade 0.15s ease;
}
@keyframes ctpphFade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.modal-body {
  font-size: 14.5px;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 18px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.modal-actions .btn {
  min-width: 76px;
}

/* 确认弹窗遮罩：独立类名，避免与通用 .modal-mask（图库/封面，默认 display:none）冲突导致弹窗不可见 */
.confirm-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  z-index: 2000;
  padding: 20px;
  animation: ctpphFade 0.15s ease;
}

/* ------------------------------ 笔记卡片多选 ------------------------------ */
.sel-all-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
  cursor: pointer;
  white-space: nowrap;
}
.sel-all-wrap input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.admin-note-card {
  position: relative;
}
.note-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.4);
  cursor: pointer;
}
.note-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.admin-note-card:has(.row-sel:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.cat-editor {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cat-row {
  display: grid;
  grid-template-columns: 1fr 1.5fr 38px;
  gap: 10px;
  align-items: center;
}
.cat-row .input {
  width: 100%;
}
.cat-row .del {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--bg-subtle);
  color: var(--text-tertiary);
}
.cat-row .del:hover {
  background: rgba(240, 68, 56, 0.12);
  color: #f04438;
}

.note-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  background: var(--bg-subtle);
}

/* 编辑器内图片插入按钮的隐藏上传控件 */
.hidden-upload {
  display: none;
}

/* ============================================================
   追加：长图文编辑器增强（封面选取 / 预览刷新）
   ============================================================ */
.cover-tabs {
  display: inline-flex;
  background: var(--bg-subtle);
  border-radius: 9px;
  padding: 3px;
  gap: 2px;
  margin-bottom: 9px;
}
.seg-btn {
  padding: 6px 13px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--text-secondary);
  background: none;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  border: none;
  font-family: inherit;
}
.seg-group {
  display: flex;
  gap: 4px;
}
.seg-btn:hover {
  color: var(--text);
}
.seg-btn.active {
  background: var(--bg-elevated);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.cover-pane.hidden {
  display: none;
}
.cover-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
}
.cover-body-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 9px;
  max-height: 220px;
  overflow-y: auto;
  padding: 2px;
}
.cover-thumb {
  aspect-ratio: 1.5;
  border-radius: 9px;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--bg-subtle);
  cursor: pointer;
  padding: 0;
  transition: all 0.15s var(--ease);
}
.cover-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cover-thumb:hover {
  border-color: var(--accent);
}
.cover-thumb.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.editor-status .status-sep {
  width: 1px;
  height: 15px;
  background: var(--border);
  margin: 0 2px;
}
.editor-status .status-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
.editor-status .status-switch input {
  appearance: none;
  width: 30px;
  height: 17px;
  border-radius: 9px;
  background: var(--border-strong);
  position: relative;
  cursor: pointer;
  transition: background 0.2s var(--ease);
  flex-shrink: 0;
}
.editor-status .status-switch input::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s var(--ease);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.editor-status .status-switch input:checked {
  background: var(--accent);
}
.editor-status .status-switch input:checked::after {
  transform: translateX(13px);
}
.editor-status .status-btn {
  padding: 4px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s var(--ease);
}
.editor-status .status-btn:hover {
  filter: brightness(0.97);
}
html[data-theme='dark'] .editor-status .status-btn:hover {
  filter: brightness(1.15);
}

/* --------------------- 视频链接自动获取 + 跳转卡片预览 --------------------- */
.fetch-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.fetch-row .input {
  flex: 1;
}
.fetch-row .btn {
  white-space: nowrap;
}
#fetchHint {
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
}

.video-jump-preview {
  border: 1px solid var(--border, #e5e6eb);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-soft, #f7f8fa);
}
.vjp-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #2b2f3a, #1c1f27);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.vjp-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.vjp-play {
  position: absolute;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  padding-left: 4px;
  box-sizing: border-box;
}
.vjp-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
}
.vjp-title {
  padding: 10px 12px 4px;
  font-weight: 600;
  font-size: 14px;
  color: var(--text, #1f2329);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.vjp-link {
  display: block;
  padding: 6px 12px 12px;
  color: var(--accent, #3370ff);
  font-size: 13px;
  text-decoration: none;
}

/* 通用隐藏 */
.hidden { display: none !important; }

/* 发布器内嵌 B站 小窗预览 */
.vjp-embed { margin-top: 10px; border-radius: 10px; overflow: hidden; background: #000; }
.vjp-embed iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; border: 0; display: block; }

/* 小红书一键导入 */
.xhs-panel { margin-top: 4px; }
.xhs-panel .fetch-row { margin-bottom: 8px; }
.xhs-panel .hint { margin: 0; }

/* 书签工具 + 小开关 */
.switch-sm { font-size: 12.5px; }
.switch-sm input { width: 15px; height: 15px; }
.bm-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.bookmarklet {
  display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  color: #fff; background: var(--accent, #F4511E); text-decoration: none; cursor: grab; user-select: none;
  border: 1px solid rgba(255,255,255,.25);
}
.bookmarklet:active { cursor: grabbing; }

/* 回到顶部浮动按钮 */
.float-top {
  position: fixed; right: 26px; bottom: 30px; z-index: 60; width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid var(--border, #e3e3e3); background: var(--card, #fff); color: var(--text, #222);
  font-size: 20px; line-height: 1; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.14);
  opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .18s, transform .18s;
}
.float-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* 通用模态层（图库 / 封面裁剪） */
.modal-mask {
  position: fixed; inset: 0; z-index: 120; display: none; align-items: center; justify-content: center;
  background: rgba(15,18,24,.55); padding: 18px;
}
.modal-mask.show { display: flex; }
.modal-box {
  width: min(880px, 96vw); max-height: 88vh; display: flex; flex-direction: column;
  background: var(--card, #fff); color: var(--text, #222); border-radius: 14px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; padding: 13px 16px;
  font-weight: 700; border-bottom: 1px solid var(--border, #ececec);
}
.modal-close { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: var(--text-tertiary, #888); }
.modal-body { padding: 16px; overflow: auto; }

/* OSS 图库 */
.oss-gallery-box { width: min(760px, 96vw); }
.oss-gallery-grid, .oss-gallery-inline { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.oss-gallery-inline { margin-top: 10px; }
.oss-thumb {
  padding: 0; border: 1px solid var(--border, #ececec); border-radius: 9px; overflow: hidden; background: #f4f4f4;
  aspect-ratio: 1 / 1; cursor: pointer;
}
.oss-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* 封面大屏选图 + 16:9 切图 */
.cover-crop-box { width: min(820px, 96vw); }
.cover-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.cover-pick {
  padding: 0; border: 1px solid var(--border, #ececec); border-radius: 10px; overflow: hidden; cursor: pointer;
  aspect-ratio: 16 / 10; background: #f4f4f4;
}
.cover-pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-pick:hover { outline: 2px solid var(--accent, #F4511E); }
.crop-stage { position: relative; max-height: 56vh; overflow: hidden; background: #111; border-radius: 10px; }
.crop-img { display: block; width: 100%; height: auto; }
.crop-sel {
  position: absolute; border: 2px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); cursor: move;
  box-sizing: border-box;
}
.crop-handle {
  position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent, #F4511E); cursor: nwse-resize;
}
.crop-bar { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

/* 标签自动补全 */
.tag-autocomplete { position: relative; }
.tag-suggest {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 220px;
  overflow-y: auto;
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,.08);
  z-index: 30;
  padding: 4px 0;
}
.tag-suggest[hidden] { display: none; }
.tag-suggest-group {
  padding: 6px 12px 4px;
  font-size: 11px;
  color: var(--text-tertiary, #9aa3af);
  letter-spacing: .3px;
}
.tag-suggest-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13.5px;
  transition: background .12s;
}
.tag-suggest-item:hover, .tag-suggest-item.active {
  background: var(--accent-soft, rgba(244,81,30,.08));
  color: var(--accent, #F4511E);
}
.tag-suggest-item .mark {
  background: var(--accent-soft, rgba(244,81,30,.18));
  color: var(--accent, #F4511E);
  border-radius: 3px;
  padding: 0 2px;
}


/* 知乎导入：编辑器预览图片灯箱（2026-09-16） */
.lb {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
}
.lb.open {
  display: flex;
}
.lb-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
}
.lb-close {
  position: absolute;
  top: 18px;
  right: 20px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 22px;
  border: none;
  cursor: pointer;
  z-index: 1;
}
.lb-img {
  max-width: 92vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 4px;
  position: relative;
  z-index: 1;
}
.lb-orig {
  position: absolute;
  bottom: 24px;
  right: 24px;
  color: #fff;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.5);
  padding: 7px 18px;
  border-radius: 18px;
  text-decoration: none;
  z-index: 1;
}
.lb-orig:hover {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
