  :root {
    color-scheme: light;
    --paper: #EBEFEF;
    --surface: #FFFFFF;
    --surface-2: #F5F8F7;
    --line: #D6DEDD;
    --line-2: #BDC9C7;
    --ink: #131E1D;
    --ink-2: #465856;
    --ink-3: #6F8280;
    --accent: #0B6B5B;
    --accent-ink: #085246;
    --accent-soft: #DEEEEA;
    --on-accent: #FFFFFF;
    --danger: #A32B26;
    --danger-soft: #F6E1DF;
    --hit: #FBEBBF;
    --shadow: 0 1px 2px rgba(19,30,29,.06), 0 8px 24px -16px rgba(19,30,29,.28);
    --r: 4px;
    --sans: "PingFang SC", "Hiragino Sans GB", "Hiragino Sans", "Microsoft YaHei", system-ui, sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, "Cascadia Mono", monospace;
  }
  @media (prefers-color-scheme: dark) {
    :root {
      color-scheme: dark;
      --paper: #0E1514; --surface: #16201F; --surface-2: #1B2625;
      --line: #293533; --line-2: #384745;
      --ink: #E4EDEB; --ink-2: #A5B6B3; --ink-3: #7A8D8A;
      --accent: #4CBBA2; --accent-ink: #7FD3BE; --accent-soft: #133029; --on-accent: #0E1514;
      --danger: #E4756D; --danger-soft: #361B19; --hit: #4A3D14;
      --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px -18px rgba(0,0,0,.9);
    }
  }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --paper: #0E1514; --surface: #16201F; --surface-2: #1B2625;
    --line: #293533; --line-2: #384745;
    --ink: #E4EDEB; --ink-2: #A5B6B3; --ink-3: #7A8D8A;
    --accent: #4CBBA2; --accent-ink: #7FD3BE; --accent-soft: #133029; --on-accent: #0E1514;
    --danger: #E4756D; --danger-soft: #361B19; --hit: #4A3D14;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px -18px rgba(0,0,0,.9);
  }
  :root[data-theme="light"] {
    color-scheme: light;
    --paper: #EBEFEF; --surface: #FFFFFF; --surface-2: #F5F8F7;
    --line: #D6DEDD; --line-2: #BDC9C7;
    --ink: #131E1D; --ink-2: #465856; --ink-3: #6F8280;
    --accent: #0B6B5B; --accent-ink: #085246; --accent-soft: #DEEEEA; --on-accent: #FFFFFF;
    --danger: #A32B26; --danger-soft: #F6E1DF; --hit: #FBEBBF;
    --shadow: 0 1px 2px rgba(19,30,29,.06), 0 8px 24px -16px rgba(19,30,29,.28);
  }

  * { box-sizing: border-box; }
  /* hidden 属性靠浏览器默认样式生效，会被 .btn 的 display:inline-flex 盖掉，这里兜底 */
  [hidden] { display: none !important; }
  body {
    margin: 0; background: var(--paper); color: var(--ink);
    font-family: var(--sans); font-size: 15px; line-height: 1.65;
    -webkit-font-smoothing: antialiased;
  }
  button, input, select, textarea { font: inherit; color: inherit; }
  :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
  @media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

  .topbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
    padding: 0 20px; height: 54px; background: var(--surface); border-bottom: 1px solid var(--line);
  }
  .brand { display: flex; align-items: baseline; gap: 9px; margin-right: auto; }
  .brand b { font-size: 15px; font-weight: 600; letter-spacing: .02em; }
  .brand span {
    font-family: var(--mono); font-size: 11px; color: var(--ink-3);
    letter-spacing: .06em; text-transform: uppercase;
  }
  .who { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-3); }
  .who select { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 4px 6px; font-size: 12.5px; }
  .wrap { max-width: 860px; margin: 0 auto; padding: 24px 20px 80px; }

  .btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 7px 14px; border-radius: var(--r); cursor: pointer; white-space: nowrap;
    border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
    font-size: 13.5px; transition: background .12s ease, border-color .12s ease;
  }
  .btn:hover { border-color: var(--ink-3); background: var(--surface-2); }
  .btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
  .btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
  .btn-danger { color: var(--danger); }
  .btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
  .btn-sm { padding: 3px 9px; font-size: 12.5px; }
  .btn-ghost { border-color: transparent; background: none; color: var(--ink-3); padding: 3px 7px; font-size: 12.5px; }
  .btn-ghost:hover { background: var(--surface-2); color: var(--ink); border-color: var(--line); }

  .toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
  .search {
    flex: 1; display: flex; align-items: center; gap: 8px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--r); padding: 0 10px; height: 36px;
  }
  .search:focus-within { border-color: var(--accent); }
  .search input { flex: 1; border: 0; background: none; height: 100%; min-width: 0; }
  .search input:focus { outline: none; }
  .search svg { width: 14px; height: 14px; stroke: var(--ink-3); fill: none; stroke-width: 1.8; flex: none; }
  .count {
    font-family: var(--mono); font-size: 11px; color: var(--ink-3);
    letter-spacing: .06em; margin-bottom: 10px; font-variant-numeric: tabular-nums;
  }

  .feed { display: flex; flex-direction: column; gap: 8px; }
  .card {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start;
    width: 100%; text-align: left; cursor: pointer; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px;
    transition: border-color .12s ease, transform .12s ease;
  }
  .card:hover { border-color: var(--line-2); transform: translateY(-1px); }
  .card h3 { margin: 0 0 5px; font-size: 16px; font-weight: 600; line-height: 1.45; text-wrap: balance; }
  .card p {
    margin: 0 0 9px; color: var(--ink-2); font-size: 13.5px; line-height: 1.6;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .card-hit {
    display: block; margin: 0 0 9px; padding: 6px 10px; border-left: 2px solid var(--accent);
    background: var(--surface-2); font-size: 12.5px; color: var(--ink-2); line-height: 1.55;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .card-hit b { font-family: var(--mono); font-size: 11.5px; color: var(--accent-ink); font-weight: 600; margin-right: 6px; }
  .card-hit mark { background: var(--hit); color: inherit; border-radius: 2px; padding: 0 1px; }
  .card-foot {
    display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
    font-size: 12px; color: var(--ink-3); font-family: var(--mono); font-variant-numeric: tabular-nums;
  }
  .card-foot .live { color: var(--accent-ink); }
  .thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 3px; border: 1px solid var(--line); background: var(--surface-2); }
  .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--line-2); flex: none; }
  .avatar {
    width: 20px; height: 20px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink);
    display: grid; place-items: center; font-family: var(--sans); font-size: 11px; font-weight: 600; flex: none;
  }

  .back {
    display: inline-flex; align-items: center; gap: 6px; background: none; border: 0;
    cursor: pointer; color: var(--ink-3); font-size: 13px; padding: 0; margin-bottom: 14px;
  }
  .back:hover { color: var(--accent); }
  .sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
  .sheet-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
  .sheet-head h2 { margin: 0 0 10px; font-size: 22px; font-weight: 600; line-height: 1.4; text-wrap: balance; }
  .byline {
    display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
    font-family: var(--mono); font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums;
  }
  .sheet-foot { display: flex; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); background: var(--surface-2); }
  .sheet-foot .spacer { margin-left: auto; }

  /* ---------- 富文本正文（详情、跟帖、编辑器共用） ---------- */
  .rich { font-size: 15px; line-height: 1.85; overflow-wrap: break-word; }
  .rich > *:first-child { margin-top: 0; }
  .rich > *:last-child { margin-bottom: 0; }
  .rich p, .rich div { margin: 0 0 .55em; }
  .rich ul, .rich ol { margin: 0 0 .7em; padding-left: 1.5em; }
  .rich img {
    max-width: 100%; height: auto; display: block; margin: 10px 0; cursor: zoom-in;
    border: 1px solid var(--line); border-radius: 3px; background: var(--surface-2);
  }
  .rich table { border-collapse: collapse; margin: 10px 0; font-size: 13px; line-height: 1.5; background: var(--surface); }
  .rich th, .rich td {
    border: 1px solid var(--line); padding: 5px 10px; text-align: left; vertical-align: top;
    white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis;
  }
  .rich th { background: var(--surface-2); font-weight: 600; }
  .rich tr:first-child td { background: var(--surface-2); font-weight: 600; }
  .rich td.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
  .rich blockquote { margin: 0 0 .7em; padding-left: 12px; border-left: 2px solid var(--line-2); color: var(--ink-2); }
  .rich a { color: var(--accent); }
  .tw { overflow-x: auto; margin: 0 0 .55em; }
  .tw table { margin: 0; }
  .body-rich { padding: 20px 24px; }

  /* ---------- 跟帖时间线 ---------- */
  .thread { margin-top: 24px; }
  .thread-head {
    display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px;
    font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
  }
  .reply {
    position: relative; background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--r); padding: 14px 18px; margin-bottom: 8px;
  }
  .reply::before {
    content: ""; position: absolute; left: -1px; top: 14px; bottom: 14px;
    width: 2px; background: var(--line-2); border-radius: 2px;
  }
  .reply-head { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 9px; }
  .reply-head .who-line {
    display: flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px;
    color: var(--ink-3); font-variant-numeric: tabular-nums;
  }
  .reply-head .who-line b { color: var(--ink); font-family: var(--sans); font-size: 13.5px; font-weight: 600; }
  .floor {
    font-family: var(--mono); font-size: 11px; color: var(--accent-ink); background: var(--accent-soft);
    padding: 1px 6px; border-radius: 2px; letter-spacing: .04em;
  }
  .edited { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }
  .reply-acts { margin-left: auto; display: flex; gap: 2px; }
  .composer-card { border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); padding: 14px 18px; }
  .composer-card .field { padding: 0; border: 0; }
  .composer-title {
    font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
    color: var(--ink-3); margin-bottom: 10px;
  }

  /* ---------- 编辑器 ---------- */
  .field { padding: 16px 24px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
  .field-label { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
  .hint { font-size: 12px; color: var(--ink-3); }
  .title-input { width: 100%; background: none; border: 0; padding: 0; font-size: 21px; font-weight: 600; line-height: 1.4; }
  .title-input:focus { outline: none; }
  .title-input::placeholder { color: var(--ink-3); font-weight: 400; }
  .editor {
    min-height: 150px; max-height: 60vh; overflow: auto; padding: 12px 14px;
    background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
  }
  .editor.tall { min-height: 260px; }
  .editor:focus { outline: none; border-color: var(--accent); background: var(--surface); }
  .editor.drag { border-color: var(--accent); border-style: dashed; background: var(--accent-soft); }
  .editor:empty::before { content: attr(data-ph); color: var(--ink-3); }
  .editor img { cursor: default; }

  .drop {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 12px;
    border: 1px dashed var(--line-2); border-radius: var(--r); background: var(--surface-2);
  }
  .drop.drag { border-color: var(--accent); background: var(--accent-soft); }
  .files { display: flex; flex-direction: column; gap: 6px; }
  .file {
    display: flex; align-items: center; gap: 10px; padding: 7px 10px;
    border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); font-size: 13px;
  }
  .file .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .file .size { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
  .file .ficon {
    width: 30px; height: 30px; flex: none; border-radius: 3px; object-fit: cover;
    border: 1px solid var(--line); background: var(--surface-2);
    display: grid; place-items: center; font-family: var(--mono); font-size: 9.5px; color: var(--ink-3);
  }
  .file a { color: var(--accent); text-decoration: none; font-size: 12.5px; }
  .file a:hover { text-decoration: underline; }
  .xbtn { border: 0; background: none; cursor: pointer; color: var(--ink-3); font-size: 15px; line-height: 1; padding: 2px 4px; }
  .xbtn:hover { color: var(--danger); }
  .row-actions { display: flex; gap: 8px; align-items: center; }

  .section { padding: 16px 24px; border-top: 1px solid var(--line); }
  .section-label {
    font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
    text-transform: uppercase; color: var(--ink-3); margin-bottom: 10px;
  }
  .history { margin-top: 24px; }
  .history h4 {
    margin: 0 0 12px; font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
    text-transform: uppercase; color: var(--ink-3); font-weight: 500;
  }
  .hist-item {
    display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 14px;
    padding: 9px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2);
  }
  .hist-item time { font-family: var(--mono); font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
  .hist-item b { color: var(--ink); font-weight: 600; }
  .empty { color: var(--ink-3); font-size: 13.5px; padding: 44px 0; text-align: center; }
  .err { color: var(--danger); font-size: 12.5px; }

  .toast {
    position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: var(--ink);
    color: var(--paper); padding: 9px 18px; border-radius: var(--r); font-size: 13.5px;
    box-shadow: var(--shadow); z-index: 60; animation: rise .18s ease; max-width: 88vw; text-align: center;
  }
  @keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } }
  .lightbox {
    position: fixed; inset: 0; z-index: 70; background: rgba(8,14,13,.86);
    display: grid; place-items: center; padding: 32px; cursor: zoom-out;
  }
  .lightbox img { max-width: 100%; max-height: 100%; border-radius: 3px; }

  @media (max-width: 720px) {
    .wrap { padding: 16px 14px 60px; }
    .sheet-head, .body-rich, .field, .sheet-foot, .section { padding-left: 16px; padding-right: 16px; }
    .card { grid-template-columns: minmax(0, 1fr); }
    .thumb { width: 100%; height: 120px; }
    .reply, .composer-card { padding: 12px 14px; }
  }

  /* ---------- 以下为接后端后新增：登录页、退出按钮、加载更多 ---------- */

  .who b { color: var(--ink); font-size: 13px; font-weight: 600; }
  .who .avatar { width: 22px; height: 22px; font-size: 11.5px; }

  .loadmore { display: flex; justify-content: center; padding: 18px 0 4px; }
  .loading { color: var(--ink-3); font-size: 13px; text-align: center; padding: 28px 0; }

  .login-page {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: var(--paper);
  }
  .login-card {
    width: 100%; max-width: 340px; background: var(--surface);
    border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
    padding: 30px 28px 24px;
  }
  .login-card .brand { display: block; margin-bottom: 22px; }
  .login-card .brand b { display: block; font-size: 17px; font-weight: 600; letter-spacing: .02em; }
  .login-card .brand span {
    display: block; margin-top: 5px; font-family: var(--mono); font-size: 11px;
    color: var(--ink-3); letter-spacing: .06em; text-transform: uppercase;
  }
  .login-field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; }
  .login-field label {
    font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
    text-transform: uppercase; color: var(--ink-3);
  }
  .login-field input {
    height: 36px; padding: 0 10px; background: var(--surface-2);
    border: 1px solid var(--line); border-radius: var(--r);
  }
  .login-field input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
  .login-remember {
    display: flex; align-items: center; gap: 7px; margin: 4px 0 18px;
    font-size: 13px; color: var(--ink-2);
  }
  .login-card .btn-primary { width: 100%; height: 38px; }
  .login-err {
    color: var(--danger); font-size: 12.5px; margin-bottom: 12px;
    background: var(--danger-soft); border-radius: var(--r); padding: 7px 10px;
  }

  /* ---------- 历史快照回看 ---------- */

  .snap {
    margin-top: 10px; padding: 10px 12px; background: var(--surface-2);
    border: 1px solid var(--line); border-left: 2px solid var(--line-2); border-radius: var(--r);
  }
  .snap + .snap { margin-top: 6px; }
  .snap-label {
    font-family: var(--mono); font-size: 11px; color: var(--ink-3);
    letter-spacing: .04em; margin-bottom: 8px;
  }
  .snap-label + .snap-label { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
  .snap-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
  .snap .rich { font-size: 14px; color: var(--ink-2); }
  .snap .rich img { max-width: 340px; }

  /* ---------- 用户管理 ---------- */

  .utable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
  .utable th, .utable td {
    padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle;
  }
  .utable th {
    font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
    text-transform: uppercase; color: var(--ink-3); font-weight: 500;
  }
  .utable td.mono { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }
  .utable tr.off td { color: var(--ink-3); }
  .utable tr.off td .name { text-decoration: line-through; }
  .utable .acts { text-align: right; white-space: nowrap; }

  .tag {
    display: inline-block; padding: 1px 7px; border-radius: 2px;
    font-family: var(--mono); font-size: 11px; letter-spacing: .04em;
  }
  .tag-admin { background: var(--accent-soft); color: var(--accent-ink); }
  .tag-off { background: var(--danger-soft); color: var(--danger); }

  .newpwd {
    margin: 12px 0 0; padding: 12px 14px; border-radius: var(--r);
    background: var(--accent-soft); border: 1px solid var(--accent);
  }
  .newpwd .label { font-size: 12.5px; color: var(--accent-ink); margin-bottom: 6px; }
  .newpwd .value {
    font-family: var(--mono); font-size: 17px; font-weight: 600;
    color: var(--ink); letter-spacing: .04em; user-select: all;
  }
  .newpwd .hint { margin-top: 6px; font-size: 12px; color: var(--ink-2); }

  .form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
  .form-row .fld { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 150px; }
  .form-row label {
    font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em;
    text-transform: uppercase; color: var(--ink-3);
  }
  .form-row input {
    height: 34px; padding: 0 10px; background: var(--surface-2);
    border: 1px solid var(--line); border-radius: var(--r);
  }
  .form-row input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
