:root {
  color-scheme: light;
  --paper: #f7f6f2;
  --surface: #ffffff;
  --surface-muted: #efeee9;
  --ink: #24282b;
  --muted: #676d70;
  --line: #d8d6cf;
  --line-strong: #aaa79f;
  --navy: #263f56;
  --navy-dark: #1e3345;
  --blue-soft: #edf1f4;
  --red: #9a3933;
  --green: #2e6b4d;
  --amber: #8a5d0a;
  --reading: "Times New Roman", "Songti SC", SimSun, serif;
  --ui: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  --shadow: none;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--ui);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  touch-action: manipulation;
}

button,
input,
textarea,
select {
  color: inherit;
  font: inherit;
}

button,
select {
  cursor: pointer;
  touch-action: manipulation;
}

button {
  -webkit-appearance: none;
  appearance: none;
}

img {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid #2f6feb;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 999;
  top: 12px;
  left: 12px;
  padding: 10px 14px;
  border-radius: 4px;
  color: white;
  background: var(--navy);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.shell {
  width: min(1080px, calc(100% - 48px));
  margin-inline: auto;
}

.sr-only,
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  color: var(--ink);
  text-decoration: none;
}

.brand__image {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid var(--ink);
  border-radius: 2px;
  object-fit: contain;
  background: white;
}

.brand__text {
  font-family: var(--reading);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: 0.015em;
}

.brand--compact .brand__image {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
}

.brand--compact .brand__text {
  font-size: 21px;
}

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgb(255 254 250 / 92%);
}

.site-header__inner {
  display: flex;
  min-height: 92px;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.site-tagline {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.public-nav a {
  color: var(--navy);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.masthead {
  padding-block: 48px 36px;
}

.masthead h1 {
  max-width: 760px;
  margin: 0;
  font-family: var(--reading);
  font-size: clamp(36px, 5vw, 46px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.catalog {
  padding-bottom: 96px;
}

.filter-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px auto auto;
  gap: 10px;
  padding: 0 0 22px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
}

.search-field input,
.select-field select,
.field input,
.field textarea,
.content-block input,
.content-block textarea,
.content-block select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--ink);
  background: white;
}

.search-field input,
.select-field select {
  height: 44px;
  padding: 0 13px;
}

.search-field input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: #92989b;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 17px;
  border: 1px solid transparent;
  border-radius: 2px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}

.button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.button--primary {
  color: white;
  background: var(--navy);
  border-color: var(--navy);
}

.button--primary:hover {
  background: var(--navy-dark);
  border-color: var(--navy-dark);
}

.button--secondary {
  color: var(--navy);
  background: var(--surface);
  border-color: var(--line-strong);
}

.button--secondary:hover {
  border-color: var(--navy);
  background: var(--blue-soft);
}

.button--ghost {
  color: var(--navy);
  background: transparent;
  border-color: transparent;
}

.button--ghost:hover {
  background: var(--blue-soft);
}

.button--danger-text {
  color: var(--red);
  background: transparent;
  border-color: transparent;
}

.button--danger-text:hover {
  border-color: #d9aaa6;
  background: #fff4f2;
}

.button--small {
  min-height: 36px;
  padding: 7px 11px;
  font-size: 13px;
}

.button--full {
  width: 100%;
}

.clear-filter {
  align-self: center;
  padding-inline: 7px;
  color: var(--muted);
  font-size: 13px;
}

.catalog-heading {
  display: flex;
  justify-content: space-between;
  margin-top: 32px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ink);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.catalog-item {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 24px;
  padding: 38px 5px 40px;
  border-bottom: 1px solid var(--line);
}

.catalog-item__number {
  padding-top: 7px;
  color: var(--line-strong);
  font-family: var(--reading);
  font-size: 15px;
  line-height: 1;
}

.eyebrow,
.catalog-item__meta,
.paper__byline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.025em;
}

.catalog-item h2 {
  max-width: 820px;
  margin: 12px 0;
  font-family: var(--reading);
  font-size: clamp(25px, 3vw, 32px);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.catalog-item h2 a {
  text-decoration: none;
}

.catalog-item h2 a:hover {
  color: var(--navy);
  text-decoration: underline;
}

.catalog-item__body > p {
  display: -webkit-box;
  max-width: 850px;
  margin: 0 0 19px;
  overflow: hidden;
  color: #555e63;
  font-family: var(--reading);
  font-size: 17px;
  line-height: 1.75;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.catalog-item__meta {
  justify-content: space-between;
  align-items: center;
}

.read-link {
  color: var(--navy);
  font-weight: 700;
  text-decoration: none;
}

.empty-state {
  padding: 88px 30px;
  border-bottom: 1px solid var(--line);
  text-align: center;
}

.empty-state h2 {
  margin: 6px 0;
  font-family: var(--reading);
  font-size: 28px;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: #eeece5;
  font-size: 12px;
}

.site-footer__inner {
  display: flex;
  min-height: 90px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

/* Reader */
.reader-shell {
  width: min(800px, calc(100% - 48px));
  margin: 0 auto;
  padding: 58px 0 88px;
}

.reader-shell--document {
  width: min(1240px, calc(100% - 48px));
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.paper {
  padding: clamp(20px, 5vw, 48px);
  border: 0;
  background: transparent;
}

.paper__header {
  margin-top: 43px;
}

.article-label {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.paper__header h1 {
  margin: 0 0 25px;
  font-family: var(--reading);
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.17;
}

.abstract {
  margin-top: 45px;
  padding: 24px 26px;
  border-left: 3px solid var(--navy);
  background: #eef1f2;
}

.abstract strong {
  display: block;
  margin-bottom: 8px;
  color: var(--navy);
  font-size: 12px;
  letter-spacing: 0.13em;
}

.abstract p {
  margin: 0;
  font-family: var(--reading);
  font-size: 17px;
  line-height: 1.75;
}

.paper__body {
  margin-top: 42px;
  overflow-wrap: anywhere;
}

.article-text {
  margin: 0 0 1.25em;
  line-height: 1.85;
}

.font-times { font-family: "Times New Roman", "Songti SC", SimSun, serif; }
.font-georgia { font-family: Georgia, "Songti SC", SimSun, serif; }
.font-arial { font-family: Arial, "Microsoft YaHei", sans-serif; }
.font-songti { font-family: "Songti SC", SimSun, STSong, serif; }
.font-system { font-family: var(--ui); }
.size-14 { font-size: 14px; }
.size-16 { font-size: 16px; }
.size-18 { font-size: 18px; }
.size-20 { font-size: 20px; }
.size-24 { font-size: 24px; }
.size-28 { font-size: 28px; }
.size-32 { font-size: 32px; }
.size-36 { font-size: 36px; }
.size-40 { font-size: 40px; }
.align-left { text-align: left; }
.align-center { text-align: center; }
.align-right { text-align: right; }

.rich-content {
  color: var(--ink);
  font-family: var(--reading);
  font-size: 18px;
  line-height: 1.78;
}

.rich-content p {
  margin: 0 0 1.15em;
}

.rich-content h2,
.rich-content h3,
.rich-content h4 {
  color: var(--ink);
  font-family: var(--reading);
  line-height: 1.28;
}

.rich-content h2 {
  margin: 2em 0 0.7em;
  padding-bottom: 0.25em;
  border-bottom: 1px solid var(--line);
  font-size: 30px;
}

.rich-content h3 {
  margin: 1.7em 0 0.6em;
  font-size: 24px;
}

.rich-content h4 {
  margin: 1.5em 0 0.5em;
  font-size: 20px;
}

.rich-content blockquote {
  margin: 1.5em 0;
  padding: 0.2em 0 0.2em 1.25em;
  border-left: 3px solid var(--line-strong);
  color: #4e5459;
}

.rich-content ul,
.rich-content ol {
  margin: 1em 0 1.35em;
  padding-left: 1.8em;
}

.rich-content li + li {
  margin-top: 0.35em;
}

.rich-content table {
  display: block;
  width: 100%;
  margin: 1.8em 0;
  overflow-x: auto;
  border-collapse: collapse;
  -webkit-overflow-scrolling: touch;
}

.rich-content th,
.rich-content td {
  min-width: 110px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  vertical-align: top;
  text-align: left;
}

.rich-content th {
  background: #f1efe9;
  font-weight: 700;
}

.rich-content figure {
  width: 100%;
  margin: 2em auto;
}

.rich-content figure[data-width="50"] { width: 50%; }
.rich-content figure[data-width="75"] { width: 75%; }
.rich-content figure[data-width="100"] { width: 100%; }

.rich-content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.6em auto;
  border: 1px solid var(--line);
}

.rich-content figure > img {
  width: 100%;
  margin: 0;
}

.rich-content figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.rich-content pre {
  max-width: 100%;
  padding: 15px;
  overflow-x: auto;
  border: 1px solid var(--line);
  background: #f7f6f2;
  font: 14px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
}

.rich-content a {
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rich-content [data-font="times"] { font-family: "Times New Roman", "Songti SC", SimSun, serif; }
.rich-content [data-font="georgia"] { font-family: Georgia, "Songti SC", SimSun, serif; }
.rich-content [data-font="arial"] { font-family: Arial, "Microsoft YaHei", sans-serif; }
.rich-content [data-font="songti"] { font-family: "Songti SC", SimSun, STSong, serif; }
.rich-content [data-font="system"] { font-family: var(--ui); }
.rich-content [data-size="14"] { font-size: 14px; }
.rich-content [data-size="16"] { font-size: 16px; }
.rich-content [data-size="18"] { font-size: 18px; }
.rich-content [data-size="20"] { font-size: 20px; }
.rich-content [data-size="24"] { font-size: 24px; }
.rich-content [data-size="28"] { font-size: 28px; }
.rich-content [data-size="32"] { font-size: 32px; }
.rich-content [data-size="36"] { font-size: 36px; }
.rich-content [data-size="40"] { font-size: 40px; }
.rich-content [data-align="left"] { text-align: left; }
.rich-content [data-align="center"] { text-align: center; }
.rich-content [data-align="right"] { text-align: right; }
.rich-content [data-align="justify"] { text-align: justify; }

.article-image {
  margin: 38px auto;
}

.article-image--50 { width: 50%; }
.article-image--75 { width: 75%; }
.article-image--100 { width: 100%; }

.article-image img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
}

.article-image figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-family: var(--reading);
  font-size: 13px;
  text-align: center;
}

.article-attachment {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin: 30px 0;
  padding: 16px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.article-attachment__type {
  padding: 8px 5px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.article-attachment__info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.article-attachment__info strong {
  font-family: var(--reading);
  font-size: 17px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.article-attachment__info small {
  color: var(--muted);
  font-size: 11px;
}

.article-attachment > a {
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.primary-document {
  margin-top: 42px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
}

.source-document {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  margin: 35px 0 30px;
  padding: 13px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.source-document > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.source-document span,
.source-document small {
  color: var(--muted);
  font-size: 11px;
}

.source-document strong {
  overflow-wrap: anywhere;
  font-family: var(--reading);
  font-size: 16px;
}

.source-document > a {
  flex: 0 0 auto;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.paper--document > .paper__header,
.paper--document > .abstract,
.paper--document > .paper__body,
.paper--document > .paper__footer {
  width: min(800px, 100%);
  margin-right: auto;
  margin-left: auto;
}

.primary-document__heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 11px 0;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.primary-document__heading h2 {
  margin: 0;
  font: inherit;
}

.document-viewer__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 17px 0;
}

.document-viewer__toolbar > div {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.document-viewer__toolbar strong {
  font-family: var(--reading);
  font-size: 18px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.document-viewer__toolbar small {
  color: var(--muted);
  font-size: 12px;
}

.document-viewer__source,
.document-viewer__fallback a {
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  text-underline-offset: 3px;
}

.document-viewer__source {
  display: inline-flex;
  min-height: 44px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--surface);
  text-decoration: none;
}

.document-viewer__source:hover {
  border-color: var(--navy);
  background: var(--blue-soft);
}

.document-viewer__actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.document-viewer__mobile-note {
  display: none;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--navy);
  color: var(--muted);
  background: var(--blue-soft);
  font-size: 12px;
}

.document-viewer__mobile-note a {
  color: var(--navy);
  font-weight: 700;
}

.document-viewer {
  border: 1px solid var(--line-strong);
  background: #d9d8d3;
}

.document-viewer__frame {
  display: block;
  width: 100%;
  height: clamp(620px, 82vh, 1000px);
  height: clamp(620px, 82dvh, 1000px);
  border: 0;
  background: #e5e4df;
}

.document-viewer__fallback {
  margin: 10px 0 14px;
  color: var(--muted);
  font-size: 12px;
}

.supplement-heading {
  margin: 0 0 24px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  font-family: var(--reading);
  font-size: 22px;
  font-weight: 600;
}

.empty-article {
  color: var(--muted);
  font-family: var(--reading);
  font-style: italic;
  text-align: center;
}

.paper__footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-top: 62px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

/* Login */
.login-page {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: 32px 20px;
  background: var(--paper);
}

.login-card {
  width: min(410px, 100%);
  padding: 39px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: none;
}

.login-card__heading {
  margin: 36px 0 28px;
}

.login-card__heading h1 {
  margin: 0;
  font-family: var(--reading);
  font-size: 31px;
  font-weight: 600;
}

.login-card__heading > p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.stack-form {
  display: grid;
  gap: 19px;
}

.stack-form label,
.field {
  display: grid;
  gap: 7px;
}

.stack-form label > span:first-child,
.field > span:first-child {
  font-size: 13px;
  font-weight: 700;
}

.stack-form input,
.field input,
.field textarea {
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: white;
}

.field textarea {
  resize: vertical;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  padding-right: 62px;
}

.password-toggle {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 48px;
  height: 36px;
  border: 0;
  color: var(--navy);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.login-card__back {
  margin-top: 28px;
}

.alert {
  margin: 0 0 22px;
  padding: 13px 15px;
  border: 1px solid;
  border-radius: 4px;
  font-size: 13px;
}

.alert--error {
  color: #762c27;
  border-color: #dfaaa6;
  background: #fff2f0;
}

.alert--warning {
  color: #674708;
  border-color: #d8be83;
  background: #fff9e8;
}

.alert--success {
  color: #21533b;
  border-color: #a4c8b4;
  background: #eff9f3;
}

/* Admin shell */
.admin-frame {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: 238px minmax(0, 1fr);
}

.admin-sidebar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  height: 100vh;
  height: 100dvh;
  flex-direction: column;
  padding: 30px 24px;
  color: var(--ink);
  background: #efeee9;
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-close,
.admin-overlay {
  display: none;
}

.admin-sidebar .brand {
  color: var(--ink);
}

.admin-nav {
  display: grid;
  gap: 7px;
  margin-top: 54px;
}

.admin-nav a {
  display: flex;
  min-height: 45px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 4px;
  color: #4f565a;
  font-size: 13px;
  font-weight: 650;
  text-decoration: none;
}

.admin-nav a span {
  width: 20px;
  color: var(--muted);
  font-family: var(--reading);
  font-size: 12px;
}

.admin-nav a:hover,
.admin-nav a[aria-current="page"] {
  color: var(--navy);
  background: white;
  box-shadow: inset 3px 0 0 var(--navy);
}

.admin-logout {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.admin-logout button {
  width: 100%;
  min-height: 42px;
  border: 0;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.admin-main {
  width: min(1260px, 100%);
  padding: 28px clamp(24px, 5vw, 66px) 80px;
}

.admin-topbar {
  display: flex;
  align-items: flex-start;
  gap: 15px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.admin-topbar h1 {
  margin: 0;
  font-family: var(--reading);
  font-size: clamp(28px, 3vw, 34px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.admin-topbar > div > p:last-child {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.mobile-menu {
  display: none;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--navy);
  background: white;
  font-size: 13px;
  font-weight: 700;
}

.admin-section,
.editor,
.settings-card {
  border: 1px solid var(--line);
  background: var(--surface);
}

.admin-section {
  padding: clamp(20px, 4vw, 34px);
}

.section-heading,
.block-heading,
.settings-card__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 25px;
}

.section-heading {
  padding-bottom: 23px;
  border-bottom: 2px solid var(--ink);
}

.section-heading__actions,
.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.section-heading h2,
.block-heading h2,
.settings-card h2 {
  margin: 0;
  font-family: var(--reading);
  font-size: 25px;
}

.section-heading p,
.block-heading p,
.settings-card__heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.admin-post-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 24px 2px;
  border-bottom: 1px solid var(--line);
}

.admin-post-row__main h2 {
  margin: 7px 0 3px;
  overflow: hidden;
  font-family: var(--reading);
  font-size: 21px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-post-row__main p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.status-badge {
  display: inline-flex;
  padding: 3px 7px;
  border: 1px solid;
  border-radius: 2px;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.status-badge--published {
  color: var(--green);
  border-color: #a9c8b7;
  background: #f0f8f3;
}

.status-badge--draft {
  color: #6a6060;
  border-color: #cbc3bd;
  background: #f5f2ef;
}

.status-badge--document {
  color: var(--navy);
  border-color: #aebdca;
  background: #f2f6f8;
}

.status-badge--article {
  color: var(--muted);
  border-color: var(--line-strong);
  background: transparent;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.empty-state--admin {
  border: 0;
}

.empty-state--admin .button {
  margin-top: 22px;
}

/* Editor */
.editor-toolbar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 10px;
  align-items: center;
  min-height: 66px;
  padding: 10px 19px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.save-status {
  color: var(--muted);
  font-size: 12px;
}

.save-status.is-saving { color: var(--amber); }
.save-status.is-saved { color: var(--green); }
.save-status.is-error { color: var(--red); }

.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 38px;
  padding: clamp(20px, 4vw, 40px);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.field--wide {
  grid-column: 1 / -1;
}

.field small {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.field b {
  color: var(--red);
}

.primary-document-setting {
  margin-top: 35px;
  padding: 23px 0;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
}

.primary-document-setting__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.primary-document-setting__heading h2 {
  margin: 0;
  font-family: var(--reading);
  font-size: 23px;
}

.primary-document-setting__heading p,
.primary-document-empty {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.primary-document-setting__body {
  margin-top: 17px;
}

.primary-document-editor {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  background: #faf9f5;
}

.primary-document-editor__type {
  padding: 9px 5px;
  color: var(--navy);
  border: 1px solid var(--line-strong);
  background: white;
  font-size: 11px;
  font-weight: 750;
  text-align: center;
}

.primary-document-editor__info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.primary-document-editor__info strong {
  overflow-wrap: anywhere;
}

.primary-document-editor__info small {
  color: var(--muted);
  font-size: 11px;
}

.primary-document-setting > [data-remove-primary-document] {
  margin-top: 10px;
}

.block-heading {
  margin-top: 45px;
  padding: 24px 0 16px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
}

.block-add-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rich-editor-section {
  min-width: 0;
}

.rich-editor-toolbar {
  position: sticky;
  z-index: 4;
  top: 66px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin-top: 16px;
  padding: 10px;
  border: 1px solid var(--line-strong);
  background: #f4f2ec;
  box-shadow: 0 3px 8px rgb(26 34 41 / 5%);
}

.rich-editor-toolbar label {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 10px;
}

.rich-editor-toolbar select {
  min-width: 110px;
  min-height: 38px;
  padding: 6px 28px 6px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--ink);
  background: white;
  font-size: 12px;
}

.rich-editor-toolbar__group {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.rich-editor-toolbar button {
  min-width: 40px;
  min-height: 38px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  color: var(--ink);
  background: white;
  font-size: 12px;
}

.rich-editor-toolbar button:hover,
.rich-editor-toolbar button:focus-visible {
  color: var(--navy);
  border-color: #8da5b9;
  background: #f9fbfd;
}

.rich-editor-canvas {
  padding: 28px;
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-top: 0;
  background: #deddd8;
  -webkit-overflow-scrolling: touch;
}

.rich-editor-content {
  width: min(816px, 100%);
  min-height: 620px;
  margin: 0 auto;
  padding: clamp(32px, 7vw, 72px);
  outline: 0;
  background: white;
  box-shadow: 0 2px 9px rgb(24 30 35 / 14%);
  caret-color: var(--ink);
  overflow-wrap: anywhere;
}

.rich-editor-content:focus {
  box-shadow: 0 0 0 3px rgb(47 111 235 / 18%), 0 2px 9px rgb(24 30 35 / 14%);
}

.rich-editor-content:empty::before {
  color: #858a8e;
  content: "在这里输入正文，或上传 DOCX 自动导入…";
}

.rich-editor-content figure,
.rich-editor-content img,
.rich-editor-content figcaption {
  cursor: text;
}

.rich-import-status {
  min-height: 20px;
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.rich-import-status.is-error {
  color: var(--red);
}

.block-list {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.content-block {
  border: 1px solid var(--line);
  background: #faf9f5;
}

.content-block:focus-within {
  border-color: #8da5b9;
  box-shadow: 0 0 0 2px rgb(47 111 235 / 11%);
}

.content-block__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 8px 14px;
  border-bottom: 1px solid var(--line);
  background: #efede7;
}

.block-type {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.1em;
}

.block-actions {
  display: flex;
  gap: 2px;
}

.block-actions button {
  min-width: 34px;
  min-height: 34px;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.block-actions button:hover {
  color: var(--navy);
  border-color: var(--line-strong);
  background: white;
}

.block-actions button[data-action="delete"]:hover {
  color: var(--red);
  border-color: #d9aaa6;
}

.content-block__body {
  padding: 15px;
}

.text-tools,
.image-tools {
  display: grid;
  grid-template-columns: repeat(3, minmax(100px, 1fr));
  gap: 9px;
  margin-bottom: 12px;
}

.text-tools label,
.image-tools label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

.text-tools select,
.image-tools select,
.image-tools input {
  min-height: 39px;
  padding: 7px 9px;
}

.block-textarea {
  min-height: 150px;
  padding: 15px;
  resize: vertical;
  font-family: var(--reading);
  line-height: 1.7;
}

.image-editor {
  display: grid;
  grid-template-columns: minmax(150px, 260px) 1fr;
  gap: 18px;
  align-items: start;
}

.image-editor__preview {
  width: 100%;
  max-height: 230px;
  object-fit: contain;
  border: 1px solid var(--line);
  background: white;
}

.image-editor__fields {
  display: grid;
  gap: 11px;
}

.image-editor__fields label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

.image-editor__fields input {
  min-height: 40px;
  padding: 8px 10px;
}

.attachment-editor {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.attachment-editor__type {
  padding: 10px 5px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  background: white;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.attachment-editor__fields {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.attachment-editor__fields label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

.attachment-editor__fields input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
}

.attachment-editor__fields small {
  color: var(--muted);
  font-size: 11px;
}

.editor-empty {
  margin-top: 18px;
  padding: 45px 20px;
  border: 1px dashed var(--line-strong);
  text-align: center;
}

.editor-empty[hidden] {
  display: none;
}

.editor-empty p {
  margin: 0 0 14px;
  color: var(--muted);
}

.editor-help {
  position: sticky;
  top: 90px;
  align-self: start;
  padding-left: 21px;
  border-left: 1px solid var(--line);
}

.editor-help h2 {
  margin: 0;
  font-family: var(--reading);
  font-size: 22px;
}

.editor-help ul {
  margin: 15px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
}

.editor-help li + li {
  margin-top: 10px;
}

.uploading-panel {
  display: grid;
  min-height: 140px;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
}

/* Settings */
.settings-grid {
  display: grid;
  gap: 22px;
}

.settings-card {
  display: grid;
  gap: 19px;
  padding: clamp(22px, 4vw, 35px);
}

.settings-card__heading {
  justify-content: flex-start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.settings-card > .field,
.settings-card > .button,
.settings-card > .form-note {
  width: min(650px, 100%);
}

.settings-card > .button {
  justify-self: start;
  width: auto;
}

.logo-setting {
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo-preview {
  display: grid;
  width: 112px;
  height: 112px;
  flex: 0 0 112px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  background: white;
}

.logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.logo-placeholder {
  color: var(--muted);
  font-size: 13px;
}

.logo-setting > div:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.logo-setting p {
  flex-basis: 100%;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  cursor: pointer;
  opacity: 0;
}

.file-button:focus-within {
  outline: 2px solid var(--navy);
  outline-offset: 3px;
}

.file-button.is-uploading {
  cursor: wait;
  opacity: 0.65;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 24px;
  bottom: 24px;
  bottom: max(24px, env(safe-area-inset-bottom));
  max-width: min(360px, calc(100% - 48px));
  padding: 13px 16px;
  border: 1px solid #adc6b7;
  border-radius: 2px;
  color: #204e37;
  background: #f0f9f4;
  box-shadow: none;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.is-error {
  color: #762c27;
  border-color: #dfaaa6;
  background: #fff2f0;
}

.error-page {
  min-height: 65vh;
  padding-block: 100px;
  text-align: center;
}

.error-code {
  margin: 0;
  color: var(--line-strong);
  font-family: var(--reading);
  font-size: 78px;
  line-height: 1;
}

.error-page h1 {
  margin: 18px 0 8px;
  font-family: var(--reading);
  font-size: 38px;
}

.error-page > p:not(.error-code) {
  margin: 0 0 28px;
  color: var(--muted);
}

@media (max-width: 1000px) {
  .admin-frame {
    grid-template-columns: 210px minmax(0, 1fr);
  }

  .admin-sidebar {
    padding-inline: 18px;
  }

  .editor-grid {
    grid-template-columns: 1fr;
  }

  .editor-help {
    position: static;
    padding: 20px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 760px) {
  .shell,
  .reader-shell {
    width: min(100% - 32px, 1080px);
  }

  .site-header__inner {
    min-height: 82px;
  }

  .site-tagline {
    display: none;
  }

  .brand__text {
    font-size: 22px;
  }

  .masthead {
    padding-block: 36px 28px;
  }

  .filter-bar {
    grid-template-columns: 1fr 1fr;
  }

  .search-field {
    grid-column: 1 / -1;
  }

  .catalog-item {
    grid-template-columns: 45px 1fr;
    gap: 14px;
  }

  .catalog-item__number {
    font-size: 23px;
  }

  .paper {
    padding: 30px 22px;
  }

  .reader-shell--document {
    width: 100%;
  }

  .paper--document {
    padding-inline: 16px;
  }

  .document-viewer__mobile-note {
    display: block;
  }

  .document-viewer__frame {
    height: clamp(400px, 72vh, 720px);
    height: clamp(400px, 72dvh, 720px);
  }

  .article-image--50,
  .article-image--75 {
    width: 100%;
  }

  .rich-content figure[data-width="50"],
  .rich-content figure[data-width="75"] {
    width: 100%;
  }

  .site-footer__inner,
  .paper__footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }

  .admin-frame {
    display: block;
  }

  .admin-sidebar {
    position: fixed;
    left: 0;
    width: min(280px, 82vw);
    height: 100vh;
    height: 100dvh;
    padding-bottom: calc(30px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
    transform: translateX(-105%);
    transition: transform 160ms ease;
  }

  .admin-sidebar.is-open {
    box-shadow: none;
    transform: translateX(0);
  }

  .sidebar-close {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    padding: 6px 9px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    color: var(--navy);
    background: white;
    font-size: 12px;
  }

  .admin-overlay {
    position: fixed;
    z-index: 15;
    inset: 0;
    display: block;
    border: 0;
    background: rgb(8 20 30 / 45%);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease;
  }

  .admin-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  body.menu-open {
    overflow: hidden;
  }

  .mobile-menu {
    display: block;
  }

  .admin-main {
    padding: 24px 16px 60px;
    padding: 24px 16px calc(60px + env(safe-area-inset-bottom));
  }

  .admin-post-row {
    grid-template-columns: 1fr;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .editor-toolbar {
    grid-template-columns: 1fr auto;
  }

  .editor-toolbar .save-status {
    text-align: right;
  }

  .editor-toolbar .button {
    width: 100%;
  }

  .editor-grid {
    padding: 18px;
  }

  .rich-editor-toolbar {
    position: static;
    align-items: stretch;
  }

  .rich-editor-toolbar label {
    flex: 1 1 135px;
  }

  .rich-editor-toolbar select {
    width: 100%;
    min-height: 44px;
  }

  .rich-editor-toolbar button {
    min-height: 44px;
  }

  .rich-editor-canvas {
    padding: 12px;
  }

  .rich-editor-content {
    min-height: 520px;
    padding: 28px 22px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .field--wide {
    grid-column: auto;
  }

  .text-tools,
  .image-tools {
    grid-template-columns: 1fr;
  }

  .image-editor {
    grid-template-columns: 1fr;
  }

  .attachment-editor {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .attachment-editor .button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .image-editor__preview {
    max-height: 320px;
  }
}

@media (max-width: 480px) {
  .site-header__inner {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    padding-block: 19px;
  }

  .public-nav {
    margin-left: 0;
  }

  .masthead h1 {
    font-size: 35px;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }

  .search-field {
    grid-column: auto;
  }

  .catalog-item {
    grid-template-columns: 1fr;
  }

  .catalog-item__number {
    display: none;
  }

  .catalog-item__meta {
    align-items: flex-start;
    flex-direction: column;
  }

  .article-attachment {
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .article-attachment > a {
    grid-column: 2;
    justify-self: start;
  }

  .document-viewer__toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .source-document {
    align-items: flex-start;
    flex-direction: column;
  }

  .document-viewer__actions {
    width: 100%;
    justify-content: flex-start;
  }

  .login-card {
    padding: 29px 22px;
  }

  .section-heading,
  .block-heading,
  .primary-document-setting__heading {
    align-items: stretch;
    flex-direction: column;
  }

  .section-heading .button {
    width: 100%;
  }

  .section-heading__actions {
    width: 100%;
  }

  .primary-document-editor {
    grid-template-columns: 50px minmax(0, 1fr);
  }

  .primary-document-editor .button {
    grid-column: 2;
    justify-self: start;
  }

  .block-add-actions .button {
    flex: 1;
  }

  .logo-setting {
    align-items: flex-start;
    flex-direction: column;
  }

  .logo-setting > div:last-child {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .settings-card > .button {
    width: 100%;
  }
}

@media (hover: none) and (pointer: coarse) {
  .button--small,
  .block-actions button,
  .rich-editor-toolbar button,
  .password-toggle,
  .sidebar-close {
    min-width: 44px;
    min-height: 44px;
  }

  .document-viewer__mobile-note {
    display: block;
  }

  .document-viewer__frame {
    height: clamp(420px, 72vh, 760px);
    height: clamp(420px, 72dvh, 760px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
