:root {
  color-scheme: light;
  --bg: #f7f7f5;
  --paper: #fff;
  --sidebar: #fafaf9;
  --surface: #f0f1ee;
  --text: #232924;
  --muted: #525b54;
  --soft: #626c64;
  --edge: #e3e6e1;
  --edge-strong: #d4dad3;
  --brand: #286047;
  --brand-dark: #194833;
  --brand-light: #e8f2ec;
  --reading-measure: 44rem;
  --red: #a23835;
  --reading-title: "Noto Serif CJK SC", "Songti SC", "SimSun", serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --sidebar-width: 248px;
  --top-height: 64px;
  font: 16px/1.5 "Inter", "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  font-synthesis: none;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-variant-numeric: tabular-nums; }
body:has(dialog[open]) { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible,
summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
h1, h2, h3, h4, h5, p { margin: 0; }
h1, h2, h3, h4, h5, strong { font-weight: 600; }
svg { display: block; flex: 0 0 auto; }
button, input, select, textarea { min-width: 0; }
input:not([type=checkbox]), select, textarea {
  border: 1px solid var(--edge-strong); background: var(--paper); border-radius: 8px;
  padding: 8px 12px; width: 100%;
}
input::placeholder, textarea::placeholder { color: var(--soft); }
input[type=checkbox] { accent-color: var(--brand); width: 16px; height: 16px; flex: none; }
textarea { resize: vertical; min-height: 100px; }
select { appearance: none; padding-right: 31px; background: linear-gradient(45deg, transparent 50%, #616c72 50%) calc(100% - 15px) 52% / 5px 5px no-repeat, linear-gradient(135deg, #616c72 50%, transparent 50%) calc(100% - 10px) 52% / 5px 5px no-repeat, var(--paper); }
summary { cursor: pointer; }
summary::-webkit-details-marker { display: none; }
.button, .icon-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  background: var(--paper); border: 1px solid var(--edge-strong); border-radius: 8px; color: var(--text);
}
.button { min-height: 36px; padding: 6px 12px; font-size: .875rem; font-weight: 500; }
.button:hover, .icon-button:hover { background: var(--surface); border-color: var(--edge-strong); }
.button.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.button.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.button.danger { background: var(--red); border-color: var(--red); color: #fff; }
.button.small { font-size: .8125rem; min-height: 32px; padding: 4px 8px; }
.icon-button { border-color: transparent; background: transparent; width: 36px; height: 36px; padding: 0; }
.brand { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 1rem; font-weight: 600; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; color: #fff; background: var(--brand); border-radius: 8px; }
.brand-suffix { color: var(--muted); font-size: .875rem; font-weight: 400; margin-left: 4px; }
.topbar {
  position: fixed; z-index: 9; inset: 0 0 auto; height: var(--top-height); display: grid;
  grid-template-columns: var(--sidebar-width) minmax(160px, 450px) 1fr; align-items: center; gap: 24px;
  background: var(--paper); border-bottom: 1px solid var(--edge); padding-right: 24px;
}
.topbar-start { padding-left: 24px; display: flex; align-items: center; gap: 8px; }
.global-search {
  height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 12px; min-width: 0;
  border: 1px solid var(--edge); border-radius: 8px; background: var(--bg); color: var(--muted);
}
.global-search:focus-within { border-color: var(--brand); background: var(--paper); }
.global-search > input { height: 100%; background: transparent; border: 0; padding: 0; outline: 0; font-size: .9rem; }
.global-search input:focus-visible { outline: 0; }
.global-search button { display: none; border: 0; background: transparent; padding: 2px; color: var(--muted); }
kbd { background: #fff; padding: 0 6px; border: 1px solid var(--edge); color: var(--soft); border-radius: 4px; font-size: .78rem; }
.topbar-end { justify-self: end; display: flex; align-items: center; gap: 12px; }
.profile { position: relative; }
.profile > summary { display: flex; align-items: center; gap: 7px; font-size: .85rem; list-style: none; padding: 3px; white-space: nowrap; }
.profile-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 12; min-width: 176px; padding: 12px; background: var(--paper); border: 1px solid var(--edge); border-radius: 12px; box-shadow: 0 8px 24px #00000012; }
.profile-menu div { padding: 0 4px 8px; font-weight: 600; }
.profile-menu small { display: block; color: var(--muted); font-weight: 400; }
.profile-menu button { width: 100%; }
.profile-menu button + button { margin-top: 6px; }
.avatar { display: inline-grid; flex: 0 0 auto; place-items: center; width: 32px; height: 32px; font-size: .875rem; font-weight: 600; border-radius: 50%; color: var(--muted); background: var(--surface); }
.mobile-menu, .overlay { display: none; }
.sidebar {
  position: fixed; z-index: 7; top: var(--top-height); bottom: 0; width: var(--sidebar-width); overflow-y: auto;
  background: var(--sidebar); padding: 24px 16px; border-right: 1px solid var(--edge);
}
.nav-row { display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 6px; font-size: .875rem; line-height: 20px; margin-bottom: 4px; min-height: 36px; }
.nav-row > svg, .tree-row :is(a, button) > svg { width: 16px; height: 16px; color: var(--soft); }
.nav-row:hover, .tree-row:hover { background: var(--surface); }
.nav-row.selected, .tree-row.selected { color: var(--brand-dark); background: var(--brand-light); font-weight: 600; }
.nav-row.selected svg, .tree-row.selected svg { color: var(--brand); }
.tree-row.on-path, .tree-row.on-path :is(button, svg) { color: var(--brand-dark); }
.tree-row.selected { box-shadow: inset 2px 0 var(--brand); }
.nav-section { color: var(--soft); padding: 24px 8px 8px; font-size: .8125rem; font-weight: 500; }
.nav-section a:hover { color: var(--brand); }
.nav-divider { border-top: 1px solid var(--edge); margin: 20px 8px 12px; }
.tree-row { display: flex; min-width: 0; border-radius: 6px; min-height: 36px; align-items: center; }
.tree-row :is(a, button) { min-width: 0; flex: 1; display: flex; align-items: center; gap: 8px; padding: 8px; font-size: .875rem; line-height: 20px; }
.tree-row button { border: 0; background: none; text-align: start; border-radius: inherit; }
.tree-name { flex: 1; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.tree-chevron { color: var(--soft); padding-inline: 4px; }
.tree-children { margin-inline-start: 15px; padding-inline-start: 8px; border-inline-start: 1px solid var(--edge-strong); }
.workspace { margin-left: var(--sidebar-width); padding: calc(var(--top-height) + 32px) 32px 56px; }
#main { max-width: 1440px; margin: 0 auto; }
.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(216px, 256px); gap: 32px; }
.home-main, .home-aside { min-width: 0; }
.home-aside { display: grid; gap: 24px; align-content: start; }
.with-feature .home-aside { padding-top: calc(2.25rem + 24px); }
.page-title { margin: 0 0 24px; }
.page-title h1 { font-size: 1.875rem; line-height: 2.25rem; font-weight: 600; }
.page-title p { margin-top: 8px; color: var(--muted); line-height: 1.65; font-size: .9375rem; }
.feature {
  display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center;
  gap: 20px; padding: 24px; background: var(--paper);
  border: 1px solid var(--edge); border-radius: 12px; margin-bottom: 24px;
}
.feature-cover {
  width: 64px; height: 88px; display: grid; place-items: center; padding-inline-start: 4px;
  background: var(--brand-dark); color: #f5f5ea; border-radius: 2px 6px 6px 2px;
  border-inline-start: 4px solid #678473; box-shadow: inset 0 0 0 1px #ffffff20;
}
.feature-cover span {
  writing-mode: vertical-rl; text-orientation: upright; font-family: var(--reading-title);
  font-size: 1rem; line-height: 1; letter-spacing: .04em;
}
.feature-content { min-width: 0; }
.feature-title { font: 600 1.5rem/1.4 var(--reading-title); overflow-wrap: anywhere; }
.feature-title:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 4px; }
.feature p { color: var(--muted); font-size: .875rem; line-height: 1.65; margin: 4px 0 8px; }
.feature-meta { display: flex; gap: 4px 8px; flex-wrap: wrap; align-items: center; color: var(--soft); font-size: .8125rem; }
.feature-meta span + span::before { content: "·"; margin-inline-end: 8px; }
.feature-confirmed { color: var(--brand-dark); }
.feature-button { color: var(--brand-dark); }
.panel { background: var(--paper); border: 1px solid var(--edge); border-radius: 12px; min-width: 0; }
.section-heading { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.section-heading h2 { font-size: 1rem; font-weight: 600; margin: 0; }
.feed-panel > .section-heading { padding: 16px 20px; border-bottom: 1px solid var(--edge); }
.aside-panel { min-width: 0; padding-top: 12px; border-top: 1px solid var(--edge-strong); }
.aside-panel .section-heading { margin-bottom: 4px; }
.subtle-link { color: var(--brand); font-size: .875rem; text-decoration: none; white-space: nowrap; }
.subtle-link:hover, .note a:hover { text-decoration: underline; text-underline-offset: 3px; }
.side-links > a, .quick-links > a {
  display: flex; gap: 8px; align-items: center; min-width: 0; min-height: 36px; padding: 8px 0;
  color: var(--muted); font-size: .875rem;
}
.side-links > a:hover, .quick-links > a:hover { color: var(--brand-dark); text-decoration: underline; text-underline-offset: 4px; }
.side-links > a + a { border-top: 1px solid var(--edge); }
.quick-links > a > svg { width: 16px; height: 16px; color: var(--soft); }
.empty {
  padding: 32px 16px; display: grid; justify-items: center; text-align: center; gap: 8px; color: var(--muted);
}
.empty strong { color: var(--text); font-weight: 600; }
.empty p { font-size: .875rem; }
.empty .button { margin-top: 4px; }
.empty-icon { width: 32px; height: 32px; display: grid; place-items: center; color: var(--soft); }
.loading { padding: 25px; color: var(--muted); text-align: center; font-size: .9rem; }
.post-row, .entry-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 16px 20px; min-width: 0; }
.post-row + .post-row, .entry-row + .entry-row, .post-row + .entry-row, .entry-row + .post-row { border-top: 1px solid var(--edge); }
.post-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.post-meta a { font-size: .9375rem; font-weight: 600; }
.post-meta time { color: var(--soft); font-size: .78rem; }
.post-text { margin: 8px 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.file-post-title { display: inline-block; overflow-wrap: anywhere; font-weight: 600; margin: 8px 0 0; }
.entry-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; color: var(--muted); background: var(--surface); }
.entry-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; font-weight: 600; }
.entry-title a:hover, .post-meta a:hover, .file-post-title:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.entry-row p { max-width: var(--reading-measure); margin-top: 6px; color: var(--muted); font-size: .9375rem; line-height: 1.65; overflow-wrap: anywhere; }
.item-footer, .topic-links { margin-top: 11px; display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; }
.item-footer > a { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; color: var(--muted); }
.item-footer > a:hover { color: var(--brand); }
.item-footer > .item-detail { margin-left: auto; white-space: nowrap; }
.tag, .item-footer > .tag { padding: 2px 8px; border-radius: 4px; background: var(--surface); color: var(--muted); font-size: .8125rem; }
.tag:hover { text-decoration: underline; }
.badge { font-size: .75rem; font-weight: 500; border-radius: 4px; padding: 2px 4px; color: var(--muted); background: var(--surface); white-space: nowrap; }
.badge.confirmed { background: var(--brand-light); color: var(--brand-dark); }
.load-more { margin: 14px auto; display: flex; }
.refresh-banner { display: flex; gap: 6px; justify-content: center; align-items: center; width: 100%; padding: 9px 12px; border: 0; border-bottom: 1px solid #d9e7dc; color: var(--brand-dark); background: #eef7ef; font-size: .87rem; }
.refresh-banner:hover { background: #e1f1e4; }
.filters summary { list-style: none; display: flex; gap: 6px; align-items: center; justify-content: flex-end; color: var(--muted); font-size: .88rem; }
.filters form { display: flex; align-items: end; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.filter-field { display: grid; min-width: 88px; gap: 3px; font-size: .79rem; color: var(--muted); }
.filter-field input, .filter-field select { font-size: .875rem; padding-block: 4px; min-height: 32px; max-width: 172px; }
.filters .subtle-link { padding: 5px 2px; }
.page-wrap { max-width: 1100px; margin: 0 auto; }
.page-heading-row { display: flex; justify-content: space-between; gap: 15px; align-items: flex-start; }
.browse-header { margin-bottom: 24px; padding: 16px 20px 20px; border: 1px solid var(--edge); border-radius: 12px; background: var(--paper); }
.browse-header .breadcrumbs { margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--edge); }
.browse-header .page-heading-row { align-items: flex-start; }
.browse-header .page-title { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.browse-header .page-title h1 { font-size: clamp(1.5rem, 3vw, 1.875rem); }
.browse-label { display: flex; min-width: 0; align-items: flex-start; gap: 12px; }
.browse-icon { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; color: var(--brand-dark); background: var(--brand-light); border-radius: 8px; }
.directory-section { margin-bottom: 23px; }
.directory-section h2 { margin-bottom: 11px; }
.directory-grid, .topic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 232px), 1fr)); gap: 12px; }
.directory-card, .topic-card {
  min-width: 0; padding: 16px; border: 1px solid var(--edge); border-radius: 8px; background: var(--paper);
}
.directory-card { display: flex; align-items: center; gap: 12px; }
.directory-card-label { flex: 1; min-width: 0; }
.directory-card strong, .directory-card small { display: block; overflow-wrap: anywhere; }
.directory-card strong { font-weight: 600; font-size: .9375rem; }
.directory-card small { margin-top: 3px; color: var(--soft); }
.directory-icon { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; background: var(--surface); color: var(--muted); border-radius: 8px; }
.directory-card > svg { color: var(--soft); }
.directory-card:hover, .topic-card:hover { border-color: var(--edge-strong); background: var(--sidebar); color: var(--brand-dark); }
.topic-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 248px), 1fr)); }
.topic-card-heading { display: flex; align-items: center; gap: 12px; }
.topic-card h2 { font-size: 1rem; overflow-wrap: anywhere; }
.topic-card p { margin-top: 12px; color: var(--muted); line-height: 1.65; font-size: .9rem; }
.breadcrumbs { color: var(--muted); font-size: .875rem; margin-bottom: 16px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 4px 8px; list-style: none; margin: 0; padding: 0; }
.breadcrumbs li { min-width: 0; display: flex; align-items: center; gap: 8px; overflow-wrap: anywhere; }
.breadcrumbs li > svg { color: var(--soft); }
.breadcrumbs [aria-current="page"] { color: var(--text); font-weight: 600; }
.breadcrumbs a:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 4px; }
.tabs { display: flex; align-items: stretch; overflow-x: auto; gap: 15px; padding: 0 17px; border-bottom: 1px solid var(--edge); }
.tabs a { position: relative; padding: 12px 7px; white-space: nowrap; font-size: .89rem; color: var(--muted); }
.tabs a:hover { color: var(--brand); }
.tabs a.current { color: var(--brand-dark); font-weight: 600; }
.tabs a.current::after { content: ""; position: absolute; height: 2px; background: var(--brand); border-radius: 2px; bottom: 0; left: 7px; right: 7px; }
.article-layout { margin: 0 auto; max-width: 1010px; }
.article-layout.with-toc { display: grid; max-width: 1230px; grid-template-columns: minmax(0, 1fr) minmax(192px, 224px); gap: 24px; align-items: start; }
.article-column { min-width: 0; }
.article { padding: 28px clamp(20px, 3vw, 40px) 36px; }
.article > :is(.article-header, .prose, .note, .detail-text, .article-files) { max-width: var(--reading-measure); margin-inline: auto; }
.article-header { border-bottom: 1px solid var(--edge); padding-bottom: 20px; margin-bottom: 24px; }
.article h1 { font-size: clamp(1.5rem, 3vw, 2.25rem); line-height: 1.4; overflow-wrap: anywhere; }
.article-layout.with-toc .article h1 { font-family: var(--reading-title); }
.article-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px 12px; margin-top: 11px; font-size: .84rem; color: var(--muted); }
.row-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.article-actions { margin-top: 15px; }
.article-toc { position: sticky; top: calc(var(--top-height) + 20px); max-height: calc(100dvh - var(--top-height) - 40px); overflow: auto; }
.article-toc summary {
  position: sticky; z-index: 1; top: 0; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 44px; padding: 8px 12px; list-style: none; font-weight: 600; font-size: .9375rem;
  background: var(--paper);
}
.article-toc[open] summary { border-bottom: 1px solid var(--edge); }
.article-toc summary:focus-visible { outline-offset: -3px; }
.article-toc:not([open]) summary svg { transform: rotate(-90deg); }
.article-toc nav { display: grid; gap: 2px; padding: 8px; }
.article-toc nav button, .article-toc nav strong {
  min-width: 0; text-align: start; border: 0; border-radius: 4px; background: none;
  color: var(--muted); padding: 6px 8px; line-height: 1.5; font-size: .8125rem; overflow-wrap: anywhere;
}
.article-toc nav strong { color: var(--text); padding-top: 12px; }
.article-toc nav button:hover { background: var(--surface); color: var(--brand); }
.prose { container-type: inline-size; line-height: 1.9; overflow-wrap: anywhere; }
.prose p { margin: 0 0 1.125em; }
.prose h2, .prose h3, .prose h4, .prose h5 { line-height: 1.45; margin: 1.2em 0 .56em; }
.prose h2 { font-size: 1.28rem; }
.prose h3, .prose h4 { font-size: 1.04rem; }
.prose code { background: var(--surface); padding: 2px 4px; border-radius: 4px; }
.chapter { scroll-margin-top: calc(var(--top-height) + 16px); }
.chapter-title { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; }
.part-divider { color: var(--brand-dark); border-top: 1px solid var(--edge-strong); background: var(--bg); font-weight: 600; padding: 12px; margin: 28px 0 8px; border-radius: 0 0 4px 4px; }
.note { border-left: 3px solid var(--edge-strong); background: var(--bg); color: var(--muted); font-size: .875rem; padding: 8px 12px; margin: 0 0 16px; }
.note a { color: var(--brand); }
.table-scroll { overflow: auto; border: 1px solid var(--edge); border-radius: 7px; }
.prose .table-scroll { margin: 16px 0 24px; }
table { width: 100%; text-align: left; border-collapse: collapse; font-size: .875rem; line-height: 1.65; }
.prose table { min-width: 520px; }
.prose th:first-child, .prose td:first-child { white-space: nowrap; }
.prose table tr > :nth-child(2) { min-width: 90px; }
.table-hint { display: none; }
@container (max-width: 520px) {
  .table-hint { display: block; font-size: .8125rem; color: var(--muted); margin: 16px 0 4px; }
  .prose .table-hint + .table-scroll { margin-top: 4px; }
}
th { background: var(--surface); color: var(--text); font-weight: 600; }
th, td { padding: 8px 12px; border-bottom: 1px solid var(--edge); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.prose tbody tr:nth-child(even) { background: var(--sidebar); }
.article-files { border-top: 1px solid var(--edge); margin-top: 17px; padding-top: 16px; }
.files { display: grid; gap: 6px; margin-top: 9px; min-width: 0; }
.file-row { display: flex; gap: 8px; align-items: center; min-width: 0; padding: 4px 8px; border: 1px solid var(--edge); border-radius: 8px; background: var(--sidebar); }
.file-main { display: flex; align-items: center; gap: 8px; text-align: left; border: 0; background: none; min-width: 0; flex: 1; padding: 2px 1px; }
.file-main:hover .file-name { color: var(--brand); }
.file-name { min-width: 0; flex: 1; overflow-wrap: anywhere; font-size: .875rem; font-weight: 600; line-height: 1.35; }
.file-name small { display: block; color: var(--soft); font-weight: 400; margin-top: 3px; }
.file-icon { width: 32px; height: 32px; flex: 0 0 32px; display: grid; place-items: center; background: var(--surface); border-radius: 4px; color: var(--muted); overflow: hidden; }
.file-icon img { width: 100%; height: 100%; object-fit: cover; }
.admin-head { padding: 13px 17px; }
.admin-table { border-radius: 0; border-width: 1px 0 0; }
.admin-table table { min-width: 520px; }
.admin-table th:first-child, .admin-table td:first-child { padding-left: 17px; }
.audit-more { margin: 12px 17px; }
.access-page { min-height: 100dvh; background: var(--bg); }
.access-header { height: 67px; padding: 15px 25px; background: var(--paper); border-bottom: 1px solid var(--edge); }
.access-card { margin: clamp(35px, 11vh, 110px) auto 30px; width: min(500px, calc(100% - 32px)); background: var(--paper); border: 1px solid var(--edge); border-radius: 11px; }
.field { display: grid; gap: 8px; margin: 12px 0; font-size: .875rem; font-weight: 600; }
.field input, .field select, .field textarea { font-weight: 400; font-size: 1rem; }
.checkbox { display: flex; gap: 7px; align-items: center; font-size: .9rem; }
.field-pair { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.form-error { margin: 10px 0 0; color: var(--red); font-size: .87rem; overflow-wrap: anywhere; }
.subtle { color: var(--muted); font-size: .82rem; }
dialog { width: min(570px, calc(100% - 24px)); max-width: none; max-height: min(90dvh, 900px); padding: 0; background: var(--paper); color: var(--text); border: 1px solid var(--edge); border-radius: 12px; box-shadow: 0 12px 48px #00000020; overflow: auto; }
dialog.wide { width: min(900px, calc(100% - 26px)); }
dialog.composer-modal { width: min(660px, calc(100% - 26px)); }
dialog::backdrop { background: #20242155; }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 11px; padding: 12px 17px; border-bottom: 1px solid var(--edge); }
.dialog-header h2 { font-size: 1.12rem; overflow-wrap: anywhere; }
.dialog-body { padding: 15px 19px; }
.dialog-footer { position: sticky; bottom: 0; display: flex; justify-content: flex-end; align-items: center; gap: 8px; border-top: 1px solid var(--edge); background: var(--paper); padding: 11px 18px; }
.compose-footer [data-add-file] { margin-right: auto; }
.save-state { color: var(--soft); font-size: .81rem; text-align: right; }
.upload-hint { margin: 7px 0 10px; }
.location-fields { border: 1px solid var(--edge); border-radius: 7px; padding: 6px 9px; margin-top: 10px; }
.location-fields summary { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; min-height: 30px; list-style: none; font-size: .88rem; }
.location-fields summary svg { color: var(--brand); }
.location-fields summary span { color: var(--muted); font-size: .78rem; margin-left: auto; }
.topic-checks { display: flex; flex-wrap: wrap; gap: 2px 13px; border: 0; padding: 1px 0 6px; margin: 0; font-size: .83rem; }
.topic-checks legend { padding: 0; margin-bottom: 3px; font-weight: 630; }
.topic-checks label { display: inline-flex; align-items: center; gap: 4px; }
.draft-drop { border-radius: 6px; }
.draft-drop.dragging { outline: 2px dashed var(--brand); outline-offset: 3px; }
.drop-hint { display: flex; gap: 6px; align-items: center; color: var(--soft); font-size: .83rem; }
.compose-file progress { width: 56px; height: 8px; accent-color: var(--brand); }
.conflict { margin: 10px 0; border: 1px solid #ddd6c1; border-radius: 7px; background: #faf8ef; padding: 9px; font-size: .86rem; }
.conflict pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 110px; overflow: auto; }
.notices { position: fixed; z-index: 15; right: 18px; bottom: 17px; display: grid; gap: 8px; width: min(345px, calc(100vw - 36px)); }
.toast { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; color: #fff; background: var(--text); padding: 12px 16px; border-radius: 8px; box-shadow: 0 4px 16px #00000020; font-size: .9rem; }
.toast a { text-decoration: underline; white-space: nowrap; }
.versions details { padding: 10px 2px; border-bottom: 1px solid var(--edge); }
.versions details:last-child { border-bottom: 0; }
.versions summary { display: flex; gap: 6px; justify-content: space-between; font-weight: 670; font-size: .88rem; }
.versions summary span { color: var(--muted); font-size: .8rem; font-weight: 400; }
.versions h3 { margin-top: 10px; }
.versions [data-action=restore-version] { margin-top: 8px; }
.preview-body img, .preview-body video { display: block; max-height: 65dvh; max-width: 100%; margin: auto; }
.preview-body iframe { display: block; width: 100%; height: 62dvh; border: 1px solid var(--edge); }
.preview-body audio { width: 100%; }
.text-preview { white-space: pre-wrap; overflow-wrap: anywhere; font: .94rem/1.6 "Consolas", "Microsoft YaHei", monospace; }
@media (max-width: 1140px) {
  :root { --sidebar-width: 224px; }
  .workspace { padding-inline: 24px; }
  .home-layout { gap: 20px; grid-template-columns: minmax(0, 1fr) minmax(184px, 208px); }
  .feature { grid-template-columns: 64px minmax(0, 1fr); gap: 12px 16px; padding: 20px; }
  .feature-cover { grid-row: span 2; align-self: start; }
  .feature-button { grid-column: 2; justify-self: start; }
}
@media (max-width: 1050px) {
  .article-layout.with-toc { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .article-toc { position: static; grid-row: 1; max-height: min(48dvh, 360px); }
  .article-toc nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .article-toc nav strong { grid-column: 1 / -1; }
  .article-toc nav button { min-height: 44px; }
}
@media (max-width: 930px) {
  .home-layout { display: block; }
  .home-aside { margin-top: 24px; grid-template-columns: 1fr 1fr; }
  .with-feature .home-aside { padding-top: 0; }
  .feature { grid-template-columns: 64px minmax(0, 1fr) auto; }
  .feature-cover { grid-row: auto; align-self: center; }
  .feature-button { grid-column: auto; }
  .topbar { grid-template-columns: var(--sidebar-width) minmax(100px, 1fr) auto; gap: 10px; }
  .topbar-end { gap: 6px; }
  .profile > summary > span:nth-child(2) { display: none; }
}
@media (max-width: 720px) {
  :root { --top-height: 108px; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: 44px 44px; align-content: center; padding: 0 12px; gap: 4px 8px; }
  .topbar-start { padding-left: 0; }
  .global-search { height: 44px; grid-row: 2; grid-column: span 2; }
  .global-search button { display: block; }
  kbd { display: none; }
  .topbar-end { grid-row: 1; grid-column: 2; gap: 8px; }
  .brand { gap: 8px; font-size: .9375rem; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-suffix { display: none; }
  .top-compose { padding-inline: 8px; min-height: 44px; }
  .mobile-menu { display: inline-flex; flex: 0 0 44px; height: 44px; }
  .profile > summary { min-height: 44px; min-width: 44px; justify-content: center; }
  .sidebar { width: min(293px, 85vw); transform: translateX(-100%); visibility: hidden; }
  .drawer-open .sidebar { transform: translateX(0); visibility: visible; z-index: 12; }
  .drawer-open .overlay { display: block; position: fixed; z-index: 10; inset: var(--top-height) 0 0; background: #20242155; border: 0; }
  .nav-row, .tree-row :is(a, button) { padding-block: 12px; }
  .workspace { margin: 0; padding: calc(var(--top-height) + 20px) 16px 36px; }
  .page-title { margin-bottom: 16px; }
  .page-title h1 { font-size: 1.5rem; line-height: 2rem; }
  .page-title p { margin-top: 4px; font-size: .875rem; }
  .feature { grid-template-columns: 52px minmax(0, 1fr); align-items: start; padding: 16px; gap: 12px; margin-bottom: 16px; }
  .feature-cover { width: 52px; height: 76px; grid-row: span 2; align-self: start; }
  .feature-cover span { font-size: .9375rem; }
  .feature-title { font-size: 1.25rem; }
  .feature-button { grid-column: 2; min-height: 40px; }
  .feed-panel > .section-heading { padding: 12px 16px; }
  .post-row, .entry-row { padding: 12px 10px; gap: 8px; }
  .post-meta { gap: 5px 7px; }
  .browse-header { padding: 12px 16px 16px; margin-bottom: 16px; }
  .browse-header .breadcrumbs { margin-bottom: 12px; }
  .browse-header .page-heading-row { gap: 8px; }
  .browse-header .page-heading-row > .button { min-height: 44px; font-size: .8125rem; padding-inline: 8px; }
  .browse-label { gap: 8px; }
  .browse-icon { width: 32px; height: 32px; flex-basis: 32px; }
  .browse-icon svg { width: 16px; height: 16px; }
  .article { padding: 20px 16px 24px; }
  .chapter-title { flex-wrap: wrap; gap: 2px 9px; margin-bottom: 6px; }
  .chapter-title h2 { margin-bottom: 0; }
  .dialog-body { padding: 12px; }
  .dialog-footer { padding: 9px 10px; padding-bottom: max(9px, env(safe-area-inset-bottom)); }
  .drop-hint { display: none; }
}
@media (max-width: 420px) {
  .home-aside { grid-template-columns: 1fr; gap: 20px; }
  .filters[open] { width: 100%; }
  .feed-panel > .section-heading:has(.filters[open]) { display: block; }
  .filters summary { justify-content: flex-start; }
  .feed-panel > .section-heading:has(.filters[open]) h2 { margin-bottom: 7px; }
  .field-pair { grid-template-columns: 1fr; gap: 0; }
}
@media (prefers-reduced-motion: no-preference) {
  .button, .nav-row, .tree-row, .feature-title, .side-links a, .quick-links a, .directory-card, .topic-card {
    transition: color 140ms var(--ease), background-color 140ms var(--ease), border-color 140ms var(--ease);
  }
}
