.admin-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: flex-end;
  margin: 0 0 18px;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--muted);
  font-size: .92rem;
}
.admin-bar a,
.admin-bar button,
.admin-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
}
.login-panel {
  max-width: 420px;
  margin: 80px auto;
  padding: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
.account-panel {
  max-width: 560px;
}
.login-back { margin: -8px 0 14px; font-size: .88rem; }
.login-back a { color: var(--accent); text-decoration: none; }
.login-back a:hover, .login-back a:focus-visible { text-decoration: underline; }
.login-note { margin: -4px 0 16px; color: var(--muted); font-size: .84rem; line-height: 1.7; }
.login-panel label,
.annotation-edit-form label {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: .9rem;
}
.login-panel input,
.annotation-edit-form input,
.annotation-edit-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: var(--paper, #fffdf8);
  color: var(--ink);
  font: inherit;
}
.annotation-edit-form textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.65;
}
.login-panel button,
.annotation-edit-form button {
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--accent);
  color: #fffdf8;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.annotation-edit-form {
  display: grid;
  gap: 8px;
  margin: 10px 0 18px;
  padding: 12px;
  border: 1px dashed rgba(var(--accent-rgb, 122, 47, 37), .38);
  border-radius: 8px;
  background: rgba(var(--accent-rgb, 122, 47, 37), .04);
}
.annotation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.annotation-actions button {
  border-radius: 999px;
}
.annotation-actions .replace-anchor-button {
  background: var(--paper, #fffdf8);
  color: var(--accent);
}
.annotation-actions .delete-annotation-button {
  border-color: #9f3429;
  background: #9f3429;
  color: #fffdf8;
}
.selection-toolbar {
  position: absolute;
  z-index: 120;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper, #fffdf8);
  box-shadow: 0 10px 28px rgba(50, 38, 25, .22);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
.selection-toolbar button {
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 7px 12px;
  background: var(--accent);
  color: #fffdf8;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.new-annotation-dialog {
  position: fixed;
  z-index: 130;
  right: min(24px, 4vw);
  bottom: min(24px, 4vw);
  width: min(420px, calc(100vw - 32px));
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper, #fffdf8);
  box-shadow: 0 16px 40px rgba(50, 38, 25, .28);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
.new-annotation-dialog[hidden],
.selection-toolbar[hidden] {
  display: none;
}
.new-annotation-dialog label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .9rem;
}
.new-annotation-dialog input,
.new-annotation-dialog textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: var(--paper, #fffdf8);
  color: var(--ink);
  font: inherit;
}
.new-annotation-dialog textarea {
  min-height: 120px;
  resize: vertical;
  line-height: 1.65;
}
.range-replace-mode .text-body {
  outline: 2px dashed rgba(var(--accent-rgb, 122, 47, 37), .45);
  outline-offset: 8px;
}
.range-replace-mode .block-text {
  cursor: text;
}
.body-editing .text-body > p[data-block-id] {
  position: relative;
  outline: 1px dashed rgba(var(--accent-rgb, 122, 47, 37), .24);
  outline-offset: 5px;
}
.body-block-tools {
  display: none;
  position: absolute;
  right: 0;
  top: -30px;
  gap: 5px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper, #fffdf8);
  box-shadow: 0 8px 22px rgba(50, 38, 25, .16);
  z-index: 20;
  text-indent: 0;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
.body-editing .text-body > p[data-block-id]:hover > .body-block-tools,
.body-editing .text-body > p[data-block-id]:focus-within > .body-block-tools {
  display: inline-flex;
}
.body-block-tools button {
  border: 0;
  border-radius: 999px;
  padding: 4px 8px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.body-block-tools button:hover {
  background: rgba(var(--accent-rgb, 122, 47, 37), .08);
}
.body-block-editor {
  margin: 14px 0 22px;
  padding: 14px;
  border: 1px dashed rgba(var(--accent-rgb, 122, 47, 37), .42);
  border-radius: 8px;
  background: rgba(var(--accent-rgb, 122, 47, 37), .045);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
.body-block-editor textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--paper, #fffdf8);
  color: var(--ink);
  font: inherit;
  line-height: 1.75;
}
.body-block-editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-top: 10px;
}
.body-block-editor-actions button {
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 7px 13px;
  background: var(--accent);
  color: #fffdf8;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.body-block-editor-actions .body-edit-cancel {
  background: var(--paper, #fffdf8);
  color: var(--accent);
}
.body-edit-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.65;
}
.body-edit-status {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 140;
  max-width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--paper, #fffdf8);
  color: var(--accent-2);
  box-shadow: 0 10px 30px rgba(50, 38, 25, .18);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: .88rem;
}
.admin-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: min(18px, 2vw);
  background: rgba(27, 22, 18, .48);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
.admin-editor-modal[hidden] {
  display: none;
}
.admin-editor-dialog {
  width: min(1760px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
  min-height: min(900px, calc(100vh - 24px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper, #fffdf8);
  box-shadow: 0 24px 70px rgba(27, 22, 18, .35);
  overflow: hidden;
}
.admin-editor-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(var(--accent-rgb, 122, 47, 37), .06);
}
.admin-editor-dialog-head h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.12rem;
}
.admin-editor-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper, #fffdf8);
  color: var(--accent);
  font: inherit;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.admin-editor-dialog-body {
  min-height: 0;
  padding: 18px 22px 22px;
  overflow: auto;
}
.article-editor-toolbar,
.toc-editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
}
.article-editor-toolbar label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .9rem;
}
.article-editor-toolbar select,
.toc-editor-title {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--paper, #fffdf8);
  color: var(--ink);
  font: inherit;
}
.article-editor-toolbar button,
.toc-editor-actions button,
.toc-editor-row button {
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 8px 13px;
  background: var(--accent);
  color: #fffdf8;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.article-editor-toolbar .article-editor-refresh,
.toc-editor-actions .toc-editor-reload,
.toc-editor-row button {
  background: var(--paper, #fffdf8);
  color: var(--accent);
}
.article-editor-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.2fr) minmax(420px, .8fr);
  gap: 16px;
  min-height: min(720px, calc(100vh - 220px));
}
.article-editor-source {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}
.article-editor-source textarea {
  width: 100%;
  min-height: min(720px, calc(100vh - 220px));
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #101820;
  color: #f5efe5;
  font: 15px/1.7 "Cascadia Code", "Consolas", monospace;
  tab-size: 2;
}
.article-editor-preview-wrap {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, .35);
  overflow: hidden;
}
.article-editor-preview-wrap > h3 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: .92rem;
}
.article-editor-preview {
  max-height: min(760px, calc(100vh - 205px));
  overflow: auto;
  padding: 16px 18px;
  color: var(--ink);
  line-height: 1.75;
}
.article-editor-preview h1,
.article-editor-preview h2,
.article-editor-preview h3 {
  margin: 1.1em 0 .55em;
  line-height: 1.3;
}
.article-editor-preview p,
.article-editor-preview blockquote,
.article-editor-preview ul {
  margin: 0 0 1em;
}
.article-editor-preview blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 12px;
  color: var(--muted);
}
.toc-editor-list {
  display: grid;
  gap: 9px;
}
.toc-editor-row {
  display: grid;
  grid-template-columns: 96px minmax(180px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(var(--accent-rgb, 122, 47, 37), .035);
}
.toc-editor-id {
  color: var(--muted);
  font-size: .88rem;
  font-weight: 700;
}
.toc-editor-title {
  width: 100%;
}
@media (max-width: 860px) {
  .admin-editor-modal {
    padding: 12px;
  }
  .article-editor-grid,
  .toc-editor-row {
    grid-template-columns: 1fr;
  }
  .article-editor-source textarea {
    min-height: 360px;
  }
  .article-editor-preview {
    max-height: 420px;
  }
}
.save-status {
  min-height: 1.4em;
  color: var(--accent-2);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: .86rem;
}
.error-message {
  color: #a02920;
  margin: 0 0 14px;
}
.success-message {
  color: var(--accent-2);
  margin: 0 0 14px;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
.account-meta {
  color: var(--muted);
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}
.admin-page {
  width: min(100%, 1280px);
}
.user-create-panel {
  margin: 0 0 24px;
}
.user-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}
.user-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: .92rem;
  line-height: 1.45;
}
.user-table th,
.user-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.user-table th {
  color: var(--muted);
  background: var(--panel-bg, #fbfaf5);
  font-weight: 700;
}
.inline-password-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(100px, 1fr) auto;
  gap: 6px;
  align-items: center;
}
.inline-password-form input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 8px;
  background: var(--paper, #fffdf8);
  color: var(--ink);
  font: inherit;
}
.inline-password-form button {
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 7px 10px;
  background: var(--accent);
  color: #fffdf8;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
@media print {
  .admin-bar,
  .annotation-edit-form,
  .body-edit-toggle,
  .article-edit-toggle,
  .toc-edit-toggle,
  .admin-editor-modal,
  .body-block-tools,
  .body-block-editor,
  .body-edit-status,
  .selection-toolbar,
  .new-annotation-dialog,
  .save-status {
    display: none !important;
  }
}
