:root {
  --primary: #1E6FD9;
  --primary-light: #E8F0FC;
  --danger: #E53935;
  --text: #1A2233;
  --text-sub: #5A6B85;
  --text-light: #98A4B5;
  --bg: #F3F6FA;
  --border: #E5EAF2;
  --white: #FFFFFF;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

/* ============ 登录页 ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1E6FD9 0%, #4A90E2 50%, #7FB3F0 100%);
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 48px 40px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
  text-align: center;
}

.login-logo { font-size: 56px; margin-bottom: 12px; }
.login-title { font-size: 22px; font-weight: 600; margin-bottom: 8px; }
.login-sub { font-size: 13px; color: var(--text-light); margin-bottom: 32px; }

.login-input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 16px;
  font-size: 14px;
  margin-bottom: 20px;
  outline: none;
  transition: border-color 0.2s;
}
.login-input:focus { border-color: var(--primary); }

.login-btn {
  width: 100%;
  height: 46px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.login-btn:hover { opacity: 0.9; }
.login-error { color: var(--danger); font-size: 13px; margin-top: 12px; height: 18px; }

/* ============ 主界面 ============ */
.main-page { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}
.brand-icon { font-size: 24px; }
.brand-name { font-size: 16px; font-weight: 600; }

.menu { flex: 1; padding: 12px 8px; overflow-y: auto; }
.menu-item {
  display: block;
  padding: 12px 16px;
  border-radius: 8px;
  color: var(--text-sub);
  text-decoration: none;
  margin-bottom: 4px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.menu-item:hover { background: var(--primary-light); color: var(--primary); }
.menu-item.active { background: var(--primary); color: var(--white); }

/* 三级分组菜单：一级标题通过「深色+粗体+左侧色块」与二级子菜单形成主次层级 */
.menu-group { margin-bottom: 6px; }
.menu-group-title {
  display: flex;
  align-items: center;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  border-radius: 8px;
  user-select: none;
  transition: background 0.15s;
}
/* 一级菜单色块：统一深色竖条，仅作主次区分的视觉锚点 */
.menu-group-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 14px;
  border-radius: 2px;
  margin-right: 10px;
  background: #333;
  flex: 0 0 auto;
}
.menu-group-title:hover { background: rgba(0,0,0,0.05); color: var(--text); }
.menu-group-title::after {
  content: '▾';
  margin-left: auto;
  font-size: 11px;
  transition: transform 0.2s;
}
.menu-group.collapsed .menu-group-title::after { transform: rotate(-90deg); }
.menu-group.collapsed .menu-group-items { display: none; }
.menu-group-items {
  padding-left: 8px;
  margin-top: 2px;
  overflow: hidden;
}
.menu-group-items .menu-item { padding-left: 28px; font-size: 14px; }

.sidebar-footer { padding: 16px; border-top: 1px solid var(--border); }
.logout-btn {
  width: 100%;
  height: 38px;
  background: var(--bg);
  color: var(--text-sub);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 13px;
}
.logout-btn:hover { color: var(--danger); border-color: var(--danger); }

.content {
  flex: 1;
  margin-left: 220px;
  padding: 24px 32px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.topbar-actions {
  display: flex;
  align-items: center;
}
.page-title { font-size: 20px; font-weight: 600; }

.add-btn {
  height: 38px;
  padding: 0 20px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.add-btn:hover { opacity: 0.9; }

/* ============ 表格 ============ */
.list-panel { background: var(--white); border-radius: 12px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.04); }

.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  padding: 14px 16px;
  background: var(--bg);
  color: var(--text-sub);
  font-weight: 500;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 14px;
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #FAFBFD; }

.cell-title { font-weight: 500; }
.cell-sub { color: var(--text-light); font-size: 12px; margin-top: 4px; }

/* 列表封面缩略图 */
.cell-thumb {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.cell-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cell-thumb-empty {
  font-size: 22px;
  color: var(--text-light);
}

/* 编辑弹窗封面图预览 */
.cover-preview {
  width: 120px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg);
  position: relative;
}
.cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cover-preview-empty {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-light);
}
.cover-change-btn {
  margin-top: 8px;
}

.status-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
}
.status-pending { background: #FEF3C7; color: #B45309; }
.status-processing { background: #E0E7FF; color: #3730A3; }
.status-done { background: #D1FAE5; color: #047857; }

.op-btn {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-sub);
  cursor: pointer;
  font-size: 12px;
  margin-right: 8px;
}
.op-btn:hover { border-color: var(--primary); color: var(--primary); }
.op-btn.danger:hover { border-color: var(--danger); color: var(--danger); }

.empty-tip { text-align: center; color: var(--text-light); padding: 60px 0; font-size: 14px; }

/* ============ 关于我们表单 ============ */
.about-panel {
  background: var(--white);
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.field { margin-bottom: 20px; }
.field label { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 8px; }

/* 配置提示框（公众号消息配置用） */
.cfg-tip {
  font-size: 13px;
  color: var(--text-sub);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.7;
}
.cfg-tip code {
  background: #EFF6FF;
  color: #1D4ED8;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  word-break: break-all;
}

/* 关键词回复列表 */
.kw-list {
  margin-bottom: 12px;
}
.kw-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fff;
}
.kw-item-keywords {
  font-weight: 500;
  color: var(--primary);
  min-width: 120px;
  max-width: 200px;
  word-break: break-all;
  flex-shrink: 0;
}
.kw-item-reply {
  flex: 1;
  color: var(--text-sub);
  font-size: 13px;
  word-break: break-all;
}
.kw-add-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.kw-add-row .input {
  flex: 1;
}
.kw-add-row .textarea {
  flex: 1;
  resize: vertical;
  min-height: 36px;
}
.kw-add-row .ghost-btn {
  flex-shrink: 0;
  margin-top: 2px;
}

.input, .textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}
.input:focus, .textarea:focus { border-color: var(--primary); }
.textarea { min-height: 100px; resize: vertical; line-height: 1.6; }
.textarea.tall { min-height: 200px; }

.primary-btn {
  height: 40px;
  padding: 0 24px;
  background: var(--primary);
  color: var(--white);
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}
.primary-btn:hover { opacity: 0.9; }

/* ============ 弹窗 ============ */
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
/* 标签管理弹窗需要盖在其他弹窗之上（它可从「添加链接文章」等弹窗内打开） */
#tagModal.modal-mask {
  z-index: 300;
}
.modal {
  background: var(--white);
  border-radius: 12px;
  width: 640px;
  max-width: 90vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  font-size: 16px;
  font-weight: 600;
}
.modal-close { cursor: pointer; color: var(--text-light); font-size: 18px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
}
.ghost-btn {
  height: 40px;
  padding: 0 20px;
  background: var(--white);
  color: var(--text-sub);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.ghost-btn.small { height: 32px; padding: 0 12px; font-size: 13px; }

/* ============ 待选文章导入弹窗 ============ */
.import-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.import-filter-label { font-size: 13px; color: var(--text-sub); }
.import-tags-bar {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: #FAFBFD;
}
.import-tags-label {
  font-size: 13px;
  color: var(--text-sub);
  white-space: nowrap;
  padding-top: 5px;
  flex-shrink: 0;
}
.import-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
}
.global-tag-chip {
  padding: 5px 14px;
  font-size: 13px;
}
.import-date-input {
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--text);
}
.import-select {
  background: var(--white);
  cursor: pointer;
  min-width: 110px;
}
.import-loading { text-align: center; color: var(--text-light); padding: 60px 0; }
.import-empty { text-align: center; color: var(--text-light); padding: 60px 0; }
.import-count { font-size: 13px; color: var(--text-sub); margin-right: auto; }

.import-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.import-item:hover { background: #FAFBFD; }
.import-checkbox { margin-top: 4px; cursor: pointer; width: 16px; height: 16px; }
.import-item-main { flex: 1; min-width: 0; }
.import-item-title { font-size: 14px; color: var(--text); line-height: 1.5; }
.import-item-time { font-size: 12px; color: var(--text-light); margin-top: 4px; }
.import-item-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* 导入列表封面缩略图 */
.import-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg);
}
.import-thumb-empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--text-light);
}

/* 导入列表分页 */
.import-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.import-page-info {
  font-size: 13px;
  color: var(--text-sub);
  min-width: 90px;
  text-align: center;
}

.tag-chip {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 12px;
  border: 1px solid var(--border);
  color: var(--text-sub);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s;
}
.tag-chip.active {
  background: var(--primary);
  color: var(--white);
  border-color: var(--primary);
}

/* 编辑弹窗内的标签多选 */
.tag-chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 0;
}
.edit-tag-chip {
  padding: 5px 14px;
  font-size: 13px;
}

/* 标签管理 */
.tag-add-row { display: flex; gap: 10px; margin-bottom: 16px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 14px;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 13px;
}
.tag-del { cursor: pointer; color: var(--text-light); font-size: 14px; }
.tag-del:hover { color: var(--danger); }
.tag-empty { color: var(--text-light); font-size: 13px; padding: 20px 0; }

/* ============ 打印二维码 ============ */
.print-qr-item {
  display: flex;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 12px;
  background: #fff;
  align-items: flex-start;
}
.print-qr-img-wrap {
  flex-shrink: 0;
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.print-qr-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  cursor: zoom-in;
}
.print-qr-img-empty {
  color: var(--text-light);
  font-size: 12px;
}
.print-qr-info {
  flex: 1;
  min-width: 0;
}
.print-qr-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--text-main);
  margin-bottom: 6px;
}
.print-qr-scene {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 8px;
}
.print-qr-scene code {
  background: #EFF6FF;
  color: #1D4ED8;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  word-break: break-all;
}
.print-qr-reply {
  font-size: 13px;
  color: var(--text-sub);
  white-space: pre-wrap;
  word-break: break-all;
  margin-bottom: 10px;
  line-height: 1.6;
}
.print-qr-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.print-qr-actions .op-btn {
  text-decoration: none;
}
.print-qr-reply-line {
  padding: 2px 0;
  border-bottom: 1px dashed var(--border);
}
.print-qr-reply-line:last-child {
  border-bottom: none;
}

/* ============ 多回复编辑器 ============ */
.reply-editor {
  width: 100%;
}
.reply-editor-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 8px;
}
.reply-editor-row .reply-editor-textarea {
  flex: 1;
  resize: vertical;
  min-height: 44px;
  line-height: 1.6;
}
.reply-editor-btns {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.reply-editor-btns .ghost-btn {
  white-space: nowrap;
  margin-top: 0;
}
.reply-editor-add {
  margin-top: 4px;
}
.reply-editor-add .ghost-btn {
  width: 100%;
  border-style: dashed;
}
.kw-add-form {
  align-items: flex-start;
  gap: 8px;
}
.kw-add-form .reply-editor {
  flex: 1;
  min-width: 0;
}
.kw-form-actions {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.kw-item-reply-line {
  padding: 1px 0;
}
.kw-item-reply-line + .kw-item-reply-line {
  border-top: 1px dashed var(--border);
}
