:root {
  color-scheme: light;
  --paper: #f7f7f4;
  --surface: #ffffff;
  --ink: #202321;
  --muted: #6d746f;
  --line: #dedfd9;
  --accent: #176c50;
  --accent-soft: #e5f0ea;
  --warm: #b4532a;
  --sidebar: #efefea;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, "Segoe UI", "Microsoft YaHei", sans-serif; letter-spacing: 0; }
button, input, select { font: inherit; letter-spacing: 0; }
button { color: inherit; }

.topbar { position: sticky; top: 0; z-index: 10; height: 64px; display: grid; grid-template-columns: 260px minmax(280px, 620px) 40px; align-items: center; gap: 24px; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(247,247,244,.96); backdrop-filter: blur(14px); }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font-weight: 650; }
.brand-mark { width: 30px; height: 30px; display: grid; place-items: center; background: var(--ink); color: white; font-family: Georgia, serif; font-size: 18px; }
.search-wrap { height: 38px; display: grid; grid-template-columns: 24px 1fr auto; align-items: center; padding: 0 10px; border: 1px solid var(--line); background: var(--surface); }
.search-wrap input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search-wrap kbd { min-width: 28px; padding: 2px 6px; text-align: center; color: var(--muted); background: var(--paper); border: 1px solid var(--line); font-size: 11px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; display: none; }

.shell { min-height: calc(100vh - 64px); display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { position: sticky; top: 64px; height: calc(100vh - 64px); display: flex; flex-direction: column; justify-content: space-between; padding: 24px 18px; background: var(--sidebar); border-right: 1px solid var(--line); overflow-y: auto; }
.nav-label { margin: 26px 10px 8px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.nav-item { width: 100%; min-height: 38px; display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border: 0; background: transparent; cursor: pointer; text-align: left; font-size: 14px; }
.nav-item:hover { background: rgba(255,255,255,.62); }
.nav-item.is-active { background: var(--surface); color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); font-weight: 650; }
.nav-item span { color: var(--muted); font-size: 12px; }
.sidebar-foot { padding: 12px 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.status-dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; background: var(--accent); border-radius: 50%; }

.workspace { min-width: 0; padding: 44px clamp(28px, 6vw, 96px) 80px; }
.library-view { max-width: 1040px; margin: 0 auto; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--warm); font-size: 11px; font-weight: 750; }
.section-heading h1 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 36px; font-weight: 500; }
.section-heading select { height: 36px; padding: 0 30px 0 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.document-list { border-top: 1px solid var(--ink); }
.document-row { width: 100%; min-height: 104px; display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 30px; align-items: center; padding: 20px 4px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.document-row:hover .document-title { color: var(--accent); }
.document-main { min-width: 0; display: grid; gap: 8px; }
.document-title { font-family: Georgia, "Songti SC", serif; font-size: 20px; line-height: 1.35; }
.document-excerpt { color: var(--muted); font-size: 13px; line-height: 1.55; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.document-side { display: grid; justify-items: end; gap: 12px; color: var(--muted); font-size: 12px; }
.type-tag { padding: 3px 7px; color: var(--accent); background: var(--accent-soft); }
.empty-state { padding: 72px 0; color: var(--muted); text-align: center; }

.reader-view { max-width: 780px; margin: 0 auto; }
.back-button { margin-bottom: 40px; padding: 0; border: 0; background: transparent; color: var(--accent); cursor: pointer; }
.article-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.reader-view > h1 { margin: 18px 0 42px; font-family: Georgia, "Songti SC", serif; font-size: 44px; line-height: 1.18; font-weight: 500; overflow-wrap: anywhere; }
.article-body { max-width: 100%; overflow-wrap: anywhere; font-family: Georgia, "Songti SC", serif; font-size: 17px; line-height: 1.82; }
.article-body h1 { display: none; }
.article-body h2 { margin: 2.3em 0 .7em; font-size: 26px; line-height: 1.35; }
.article-body h3 { margin-top: 2em; font-size: 20px; }
.article-body img { display: block; max-width: 100%; height: auto; margin: 28px auto; }
.article-body pre { overflow-x: auto; padding: 18px; background: #242825; color: #eef1ee; font-family: Consolas, monospace; font-size: 13px; }
.article-body code { font-family: Consolas, monospace; font-size: .88em; }
.article-body :not(pre) > code { padding: 2px 5px; background: #ecece7; }
.article-body blockquote { margin: 24px 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--warm); color: #525853; }
.article-body a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
.article-body table { display: block; width: 100%; overflow-x: auto; border-collapse: collapse; font-family: Inter, "Microsoft YaHei", sans-serif; font-size: 14px; }
.article-body th, .article-body td { padding: 9px; border: 1px solid var(--line); text-align: left; }

@media (max-width: 760px) {
  .topbar { height: auto; min-height: 60px; grid-template-columns: 1fr 40px; gap: 10px; padding: 10px 14px; }
  .brand { font-size: 14px; }
  .search-wrap { grid-column: 1 / -1; grid-row: 2; }
  .icon-button { display: block; }
  .shell { display: block; }
  .sidebar { position: fixed; z-index: 9; top: 112px; left: 0; width: min(84vw, 310px); height: calc(100vh - 112px); transform: translateX(-102%); transition: transform .18s ease; box-shadow: 12px 0 32px rgba(0,0,0,.12); }
  .sidebar.is-open { transform: translateX(0); }
  .workspace { padding: 30px 18px 64px; }
  .section-heading { align-items: flex-start; }
  .section-heading h1 { font-size: 30px; }
  .document-row { min-height: 112px; grid-template-columns: minmax(0,1fr) 72px; gap: 14px; }
  .document-title { font-size: 18px; }
  .document-excerpt { display: -webkit-box; white-space: normal; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .reader-view > h1 { font-size: 34px; }
  .article-body { font-size: 16px; line-height: 1.75; }
  .document-side time { font-size: 0; }
  .document-side time::after { content: attr(data-short); font-size: 12px; }
}
