:root {
  --ink: #141b2d;
  --muted: #687287;
  --line: #dce2ea;
  --bg: #f3f6f9;
  --paper: #ffffff;
  --blue: #2463df;
  --blue-soft: #eaf1ff;
  --green: #21875a;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 236px; padding: 20px 16px;
  background: var(--paper); border-right: 1px solid var(--line); display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; margin: 2px 6px 28px; }
.brand-mark { width: 36px; height: 36px; display: grid; place-items: center; color: white; background: var(--ink); border-radius: 7px; font-weight: 800; }
.brand b, .brand small { display: block; }
.brand small { color: var(--muted); margin-top: 2px; }
nav { display: grid; gap: 5px; }
nav button { border: 0; background: transparent; color: var(--ink); padding: 11px 12px; text-align: left; border-radius: 6px; }
nav button:hover, nav button.active { background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.sidebar-bottom { margin-top: auto; padding: 16px 8px 0; border-top: 1px solid var(--line); display: grid; gap: 9px; font-size: 13px; }
.sidebar-bottom a { color: var(--blue); text-decoration: none; }
.sidebar-bottom span { color: var(--muted); overflow-wrap: anywhere; }
main { margin-left: 236px; padding: 38px clamp(24px, 4vw, 64px) 80px; max-width: 1320px; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
h1, h2, h3, p { margin-top: 0; }
.topbar h1 { margin-bottom: 7px; font-size: 28px; }
.topbar p { color: var(--muted); margin: 0; }
.primary, .secondary { min-height: 42px; padding: 0 17px; border-radius: 6px; font-weight: 700; }
.primary { border: 1px solid var(--blue); color: white; background: var(--blue); }
.secondary { border: 1px solid var(--line); color: var(--ink); background: white; }
.notice { padding: 13px 15px; margin-bottom: 18px; border: 1px solid #f0d9a8; background: #fff9eb; border-radius: 6px; color: #72511e; }
.feed { display: grid; gap: 12px; }
.topic-row { background: var(--paper); border: 1px solid var(--line); border-radius: 7px; padding: 19px 20px; display: block; }
.topic-row:hover { border-color: #b5c4d9; }
.topic-main { min-width: 0; }
.topic-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; }
.topic-heading { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; }
.topic-heading h2 { margin: 0; }
.topic-subline { display: flex; gap: 8px; margin-top: 7px; color: var(--muted); font-size: 12px; }
.badge { padding: 3px 7px; border-radius: 999px; background: #eef2f6; }
.badge.announcement { background: #fff0db; color: #92581a; }
.topic-row h2 { font-size: 18px; margin: 0; }
.topic-row h2 button { border: 0; padding: 0; background: transparent; color: var(--ink); text-align: left; font-weight: 750; }
.topic-excerpt { margin: 0; color: #4f5a6e; line-height: 1.7; white-space: pre-line; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.topic-thumb { width: 92px; height: 72px; object-fit: cover; border-radius: 5px; border: 1px solid var(--line); }
.topic-stats { display: flex; gap: 16px; color: var(--muted); font-size: 13px; margin-top: 14px; }
.topic-stats button { border: 0; background: transparent; color: inherit; padding: 0; }
.empty { padding: 72px 20px; text-align: center; color: var(--muted); border-top: 1px solid var(--line); }
dialog { border: 0; border-radius: 8px; box-shadow: 0 22px 70px #10182833; padding: 0; }
dialog::backdrop { background: #11182780; }
.topic-dialog { width: min(820px, calc(100vw - 28px)); max-height: 88vh; overflow: auto; padding: 32px; }
.compose-dialog { width: min(680px, calc(100vw - 28px)); max-height: 92vh; overflow: auto; }
.compose-dialog form { padding: 28px; }
.dialog-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.dialog-head p { color: var(--muted); }
.icon-close { border: 0; background: transparent; font-size: 27px; line-height: 1; color: var(--muted); padding: 2px 5px; }
.topic-dialog > .icon-close { float: right; }
label { display: block; margin: 16px 0 7px; font-size: 13px; color: var(--muted); }
label span { font-weight: 400; }
input, textarea, select { width: 100%; border: 1px solid #bdc7d6; border-radius: 6px; padding: 11px 12px; background: white; color: var(--ink); }
textarea { min-height: 170px; resize: vertical; line-height: 1.65; }
.rich-editor { min-height: 190px; max-height: 430px; overflow: auto; border: 1px solid #bdc7d6; border-radius: 6px; padding: 11px 12px; background: white; line-height: 1.7; white-space: pre-wrap; outline: none; }
.rich-editor:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #2463df1a; }
.rich-editor:empty::before { content: attr(data-placeholder); color: #8792a5; pointer-events: none; }
.inline-image { position: relative; width: fit-content; max-width: 100%; margin: 14px 0; padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: #f7f9fc; }
.inline-image img { display: block; max-width: 100%; max-height: 320px; border-radius: 5px; object-fit: contain; }
.inline-image button { position: absolute; top: 14px; right: 14px; min-width: 54px; height: 30px; border: 1px solid #efb4b9; border-radius: 5px; color: #b42318; background: #fffffff0; }
.caret-line { min-height: 1.7em; margin: 2px 0; }
.upload-help { margin: 0 0 9px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.image-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 11px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; }
.image-tools input[type="file"] { width: min(100%, 320px); padding: 7px; }
.image-tools button:disabled { opacity: .5; cursor: not-allowed; }
#imageSelection { color: var(--muted); font-size: 13px; }
.uploaded-images { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.uploaded-image { padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.uploaded-image img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #f7f9fc; border-radius: 4px; }
.uploaded-image span { display: block; margin: 6px 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.uploaded-image button { width: 100%; height: 32px; border: 1px solid var(--line); border-radius: 5px; color: var(--ink); background: white; }
.uploaded-image button.inserted { color: var(--green); border-color: #a8d9c3; background: #effaf5; }
.checks { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 10px; }
.checks label { margin: 0; color: var(--ink); }
.checks input { width: auto; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.form-notice { color: #b42318; min-height: 20px; margin-top: 10px; }
.detail-meta { color: var(--muted); font-size: 13px; }
.detail-body { white-space: pre-wrap; line-height: 1.8; margin: 24px 0; }
.detail-document { margin: 24px 0; }
.detail-text { line-height: 1.8; margin: 0 0 14px; }
.detail-document > img { display: block; width: auto; max-width: 100%; max-height: 720px; margin: 14px 0 20px; object-fit: contain; border-radius: 6px; }
.detail-images { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.detail-images img { width: 100%; max-height: 520px; object-fit: contain; background: #f7f8fa; border-radius: 6px; }
.detail-actions { display: flex; gap: 14px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--line); }
.like-button { border: 1px solid var(--line); border-radius: 6px; background: white; padding: 8px 12px; }
.comments { margin-top: 22px; }
.comment { padding: 15px 0; border-bottom: 1px solid var(--line); }
.comment header { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.comment p { margin: 8px 0 0; white-space: pre-wrap; line-height: 1.65; }
.comment-form textarea { min-height: 92px; }
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; padding: 12px 15px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin: 0 0 12px; }
  nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  nav button { text-align: center; padding: 9px 4px; font-size: 13px; }
  .sidebar-bottom { display: none; }
  main { margin-left: 0; padding: 24px 14px 60px; }
  .topbar { align-items: center; }
  .topic-row { grid-template-columns: minmax(0, 1fr); }
  .topic-thumb { width: 100%; height: 170px; }
  .detail-images { grid-template-columns: 1fr; }
}
