/* ===== 富文本编辑器（发帖 / 回复） ===== */
.rte {
  border: 1px solid #d9dee5;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.rte-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: #f7f9fc;
  border-bottom: 1px solid #e4e9f0;
}
.rte-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #374151;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rte-btn:hover { background: #e8eef7; border-color: #d4deeb; }
.rte-btn.on { background: #dbe7fb; border-color: #b9cdf0; color: #1d4ed8; }
.rte-sep {
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: #dde3ec;
}
.rte-sel {
  height: 28px;
  max-width: 104px;
  padding: 0 4px;
  border: 1px solid #d9dee5;
  border-radius: 5px;
  background: #fff;
  color: #374151;
  font-size: 12px;
  cursor: pointer;
}
.rte-color { position: relative; display: inline-flex; align-items: center; }
.rte-cbtn { flex-direction: column; padding: 0 6px; height: 28px; }
.rte-a { font-size: 14px; font-weight: 700; line-height: 1; }
.rte-a-bg { background: #f0a020; padding: 0 2px; border-radius: 2px; color: #fff; }
.rte-swbar {
  display: block;
  width: 16px;
  height: 4px;
  margin-top: 1px;
  border-radius: 2px;
  background: transparent;
}
.rte-palette {
  display: none;
  position: absolute;
  top: 32px;
  left: 0;
  z-index: 30;
  width: 168px;
  padding: 8px;
  background: #fff;
  border: 1px solid #dfe5ee;
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(20, 32, 56, .14);
  gap: 6px;
  grid-template-columns: repeat(7, 1fr);
}
.rte-palette.show { display: grid; }
.rte-sw {
  width: 18px;
  height: 18px;
  padding: 0;
  border: 1px solid rgba(0, 0, 0, .12);
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  color: #6b7280;
  background: #fff;
}
.rte-area {
  padding: 12px 14px;
  outline: none;
  font-size: 15px;
  line-height: 1.75;
  color: #22272e;
  overflow-y: auto;
  word-break: break-word;
}
.rte-area:empty::before {
  content: attr(data-placeholder);
  color: #9aa4b2;
  pointer-events: none;
}
.rte-area img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 4px 0;
  vertical-align: bottom;
}
.rte-area blockquote {
  margin: 8px 0;
  padding: 4px 12px;
  border-left: 3px solid #b9cdf0;
  background: #f5f8fd;
  color: #4b5563;
}
.rte-area pre {
  margin: 8px 0;
  padding: 10px 12px;
  background: #f4f6f9;
  border: 1px solid #e4e9f0;
  border-radius: 6px;
  overflow-x: auto;
  font-family: Consolas, Menlo, monospace;
  font-size: 13px;
  white-space: pre-wrap;
}
.rte-area a { color: #2563a8; text-decoration: underline; }
.rte-area ul, .rte-area ol { margin: 8px 0 8px 22px; }
.rte-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  border-top: 1px solid #eef1f6;
  background: #fbfcfe;
  font-size: 12px;
  color: #8a94a6;
}
.rte-count.over { color: #d0021b; font-weight: 600; }
.rte-tip { color: #2563a8; }
.rte-tip.err { color: #d0021b; }
.rte-preview {
  padding: 12px 14px;
  border-top: 1px dashed #dfe5ee;
  background: #fafcff;
  font-size: 15px;
  line-height: 1.75;
  color: #22272e;
}
.rte-preview img { max-width: 100%; height: auto; border-radius: 6px; }
.rte-preview .rte-empty { color: #9aa4b2; margin: 0; }

/* 详情页 / 列表页富文本正文 */
.rich-body { line-height: 1.8; word-break: break-word; }
.rich-body img { max-width: 100%; height: auto; border-radius: 6px; display: block; margin: 8px 0; }
.rich-body p { margin: 0 0 10px; }
.rich-body h1, .rich-body h2, .rich-body h3 { margin: 14px 0 8px; line-height: 1.4; }
.rich-body blockquote {
  margin: 10px 0;
  padding: 6px 14px;
  border-left: 3px solid #b9cdf0;
  background: #f5f8fd;
  color: #4b5563;
}
.rich-body pre {
  margin: 10px 0;
  padding: 10px 12px;
  background: #f4f6f9;
  border: 1px solid #e4e9f0;
  border-radius: 6px;
  overflow-x: auto;
  font-family: Consolas, Menlo, monospace;
  font-size: 13px;
  white-space: pre-wrap;
}
.rich-body ul, .rich-body ol { margin: 8px 0 8px 22px; }
.rich-body a { color: #2563a8; text-decoration: underline; }
.rich-body hr { border: 0; border-top: 1px solid #e4e9f0; margin: 14px 0; }
.rich-body table { border-collapse: collapse; max-width: 100%; margin: 10px 0; }
.rich-body td, .rich-body th { border: 1px solid #dfe5ee; padding: 6px 10px; }

/* 移动端：工具栏紧凑 */
@media (max-width: 720px) {
  .rte-bar { gap: 1px; padding: 5px; }
  .rte-btn { min-width: 26px; height: 26px; font-size: 12px; }
  .rte-sel { max-width: 82px; font-size: 11px; }
  .rte-area { padding: 10px; font-size: 14px; }
}
