:root {
  --paper: #f4f1ea;
  --paper-deep: #e9e4da;
  --ink: #222523;
  --muted: #737873;
  --line: #d8d4cb;
  --panel: #fbfaf7;
  --accent: #be4d31;
  --accent-soft: #f1ded6;
  --olive: #70775b;
  --shadow: 0 22px 50px rgba(34, 37, 35, .07);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--paper); }
body { margin: 0; overflow-x: hidden; color: var(--ink); background: var(--paper); font-family: Inter, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; }
button, input { font: inherit; }
button { color: inherit; }

.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 250px; flex: 0 0 250px; padding: 30px 20px 24px; background: #ece8df; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.brand-block { display: flex; gap: 12px; align-items: center; }
.brand-mark, .empty-mark { display: grid; place-items: center; width: 36px; height: 36px; background: var(--ink); color: #f7f2e9; font-family: Georgia, serif; font-size: 22px; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: .08em; }
.brand-subtitle { margin-top: 3px; color: var(--muted); font-size: 9px; letter-spacing: .16em; }
.sidebar-rule { height: 1px; margin: 31px 0 25px; background: var(--line); }
.rail-label { margin: 0 10px 10px; color: #8c9088; font-size: 10px; letter-spacing: .17em; text-transform: uppercase; }
.domain-label { margin-top: 28px; }
.rail-button, .domain-button { width: 100%; border: 0; border-radius: 3px; padding: 10px; background: transparent; display: flex; justify-content: space-between; align-items: center; text-align: left; cursor: pointer; font-size: 13px; }
.rail-button strong, .domain-button strong { color: var(--muted); font-size: 11px; font-weight: 500; }
.rail-button.is-active, .domain-button.is-active { background: var(--ink); color: #faf7f0; }
.rail-button.is-active strong, .domain-button.is-active strong { color: #d8d4cb; }
.domain-nav { display: grid; gap: 2px; }
.sidebar-footer { margin-top: auto; padding: 17px 8px 0; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; color: #8a8d85; font-size: 10px; line-height: 1.5; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--olive); box-shadow: 0 0 0 4px rgba(112,119,91,.12); }

.main-panel { min-width: 0; width: 100%; padding: 36px 48px 70px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; max-width: 1500px; margin: 0 auto; }
.eyebrow, .card-kicker, .section-index { color: var(--muted); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
h1 { margin: 13px 0 0; font-family: Georgia, "Songti SC", serif; font-size: clamp(30px, 4vw, 52px); font-weight: 400; letter-spacing: .01em; }
.topbar-meta { display: flex; gap: 12px; align-items: center; padding-top: 8px; color: var(--muted); font-size: 11px; }
.topbar-divider { width: 1px; height: 14px; background: var(--line); }
.overview-grid { display: grid; grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(130px, 1fr)); gap: 10px; max-width: 1500px; margin: 42px auto 30px; }
.overview-card, .metric-card { min-height: 124px; padding: 20px; border: 1px solid var(--line); background: var(--panel); }
.overview-card-primary { background: var(--ink); color: #f8f4ec; border-color: var(--ink); }
.overview-card-primary .card-kicker { color: #aeb1aa; }
.card-value { margin-top: 18px; font-family: Georgia, "Songti SC", serif; font-size: 23px; }
.card-caption { max-width: 340px; margin-top: 8px; color: #b7bbb3; font-size: 11px; line-height: 1.6; }
.metric-card { display: flex; flex-direction: column; justify-content: space-between; }
.metric-card span { color: var(--muted); font-size: 11px; }
.metric-card strong { font-family: Georgia, "Songti SC", serif; font-size: 28px; font-weight: 400; }

.workspace { max-width: 1500px; margin: 0 auto; border-top: 1px solid var(--ink); }
.workspace-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 17px 0 12px; }
.toolbar-title { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 700; }
.section-index { color: var(--accent); font-size: 11px; }
.search-box { width: min(340px, 100%); height: 36px; display: flex; align-items: center; gap: 8px; padding: 0 10px; border: 1px solid var(--line); background: var(--panel); }
.search-icon { color: var(--accent); font-size: 22px; line-height: 1; transform: rotate(-20deg); }
.search-box input { min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.search-box kbd { color: var(--muted); font-size: 10px; }
.filter-row { display: flex; gap: 7px; flex-wrap: wrap; padding-bottom: 16px; }
.filter-chip { border: 1px solid var(--line); border-radius: 20px; padding: 6px 11px; background: transparent; color: var(--muted); cursor: pointer; font-size: 11px; }
.filter-chip.is-active { background: var(--accent-soft); border-color: #e4bcae; color: #873a29; }
.content-grid { display: grid; grid-template-columns: minmax(300px, .7fr) minmax(0, 1.7fr); min-height: 620px; border-top: 1px solid var(--line); }
.asset-list-panel { min-width: 0; border-right: 1px solid var(--line); }
.list-heading { display: flex; justify-content: space-between; padding: 14px 17px; color: var(--muted); font-size: 11px; }
.list-sort { color: #9a9d96; }
.asset-list { max-height: 790px; overflow-y: auto; }
.asset-item { width: 100%; padding: 15px 17px; border: 0; border-top: 1px solid #e5e1d9; background: transparent; text-align: left; cursor: pointer; }
.asset-item:hover { background: #f0ece4; }
.asset-item.is-selected { background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.asset-item-title { display: block; overflow: hidden; color: var(--ink); font-size: 13px; font-weight: 650; line-height: 1.5; text-overflow: ellipsis; white-space: nowrap; }
.annotation-badge { display: inline-block; margin-left: 8px; padding: 2px 5px; border-radius: 2px; background: var(--accent-soft); color: var(--accent); font-size: 9px; font-weight: 500; vertical-align: 2px; }
.asset-item-meta { display: flex; gap: 7px; align-items: center; margin-top: 7px; color: var(--muted); font-size: 10px; }
.asset-tag { color: var(--accent); }
.reader-panel { min-width: 0; background: var(--panel); }
.reader-empty { min-height: 620px; display: grid; place-content: center; justify-items: center; padding: 30px; text-align: center; }
.reader-empty .empty-mark { margin-bottom: 19px; background: var(--accent); }
.reader-empty h2 { margin: 0; font-family: Georgia, "Songti SC", serif; font-size: 25px; font-weight: 400; }
.reader-empty p { max-width: 300px; margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.reader-head { padding: 28px 34px 20px; border-bottom: 1px solid var(--line); }
.reader-head .reader-meta { color: var(--accent); font-size: 10px; letter-spacing: .1em; }
.reader-head h2 { margin: 10px 0 0; font-family: Georgia, "Songti SC", serif; font-size: 28px; font-weight: 400; line-height: 1.25; }
.reader-head p { margin: 12px 0 0; color: var(--muted); font-size: 11px; }
.annotation-panel { padding: 20px 34px; border-bottom: 1px solid var(--line); background: #f4f0e8; }
.annotation-title { margin-bottom: 10px; color: var(--muted); font-size: 11px; letter-spacing: .08em; }
.tag-editor { display: flex; gap: 8px; }
.tag-editor input, .annotation-panel textarea { border: 1px solid var(--line); outline: 0; background: var(--panel); color: var(--ink); font-size: 12px; }
.tag-editor input { min-width: 0; flex: 1; height: 34px; padding: 0 10px; }
.tag-editor button, .annotation-footer button { border: 0; border-radius: 2px; padding: 0 12px; background: var(--ink); color: #faf7f0; cursor: pointer; font-size: 11px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 25px; padding-top: 9px; }
.saved-tag { border: 1px solid #dfb6a8; border-radius: 14px; padding: 4px 8px; background: var(--accent-soft); color: #8a3f2d; cursor: pointer; font-size: 10px; }
.annotation-panel textarea { width: 100%; min-height: 74px; margin-top: 10px; padding: 10px; resize: vertical; line-height: 1.6; }
.annotation-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; color: var(--muted); font-size: 10px; }
.reader-body { max-width: 850px; padding: 28px 34px 60px; color: #333733; font-family: "Songti SC", "Noto Serif CJK SC", serif; font-size: 15px; line-height: 1.85; }
.reader-body h1, .reader-body h2, .reader-body h3, .reader-body h4 { margin: 28px 0 10px; font-family: Inter, "PingFang SC", sans-serif; line-height: 1.35; }
.reader-body h1 { font-size: 25px; }
.reader-body h2 { font-size: 20px; border-bottom: 1px solid var(--line); padding-bottom: 7px; }
.reader-body h3 { font-size: 16px; }
.reader-body p { margin: 0 0 14px; }
.reader-body ul, .reader-body ol { padding-left: 25px; }
.reader-body li { padding-left: 4px; }
.reader-body blockquote { margin: 18px 0; padding: 2px 0 2px 17px; border-left: 3px solid var(--accent); color: #666b65; }
.reader-body code { padding: 2px 5px; background: #eeebe4; color: #8a3e2c; font-family: ui-monospace, monospace; font-size: .88em; }
.reader-body pre { overflow: auto; padding: 16px; background: #242825; color: #e8e5dc; line-height: 1.6; }
.reader-body pre code { padding: 0; background: transparent; color: inherit; }
.reader-body a { color: var(--accent); }
.reader-body hr { border: 0; border-top: 1px solid var(--line); margin: 25px 0; }
.reader-body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-family: Inter, "PingFang SC", sans-serif; font-size: 12px; }
.reader-body th, .reader-body td { padding: 8px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.reader-body th { background: #efebe3; }
.error-message { padding: 28px 34px; color: var(--accent); }

@media (max-width: 980px) {
  .sidebar { width: 205px; flex-basis: 205px; }
  .main-panel { padding: 28px 24px 50px; }
  .overview-grid { grid-template-columns: 1fr 1fr 1fr; }
  .overview-card-primary { grid-column: 1 / -1; }
}
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { width: 100%; padding: 18px 18px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar-rule, .sidebar-footer { display: none; }
  .rail-label { display: none; }
  .rail-button { width: auto; margin-top: 15px; padding: 8px 10px; }
  .domain-label { display: block; margin: 14px 0 7px; }
  .domain-nav { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .domain-nav::-webkit-scrollbar { display: none; }
  .domain-button { width: auto; flex: 0 0 auto; padding: 7px 10px; white-space: nowrap; font-size: 11px; }
  .domain-button strong { display: none; }
  .main-panel { padding: 24px 16px 40px; }
  .topbar-meta { display: none; }
  h1 { font-size: 34px; }
  .overview-grid { grid-template-columns: 1fr 1fr; margin-top: 28px; }
  .overview-card-primary { grid-column: 1 / -1; }
  .metric-card { min-height: 98px; }
  .workspace-toolbar { align-items: flex-start; flex-direction: column; gap: 14px; }
  .search-box { width: 100%; }
  .content-grid { display: block; }
  .asset-list-panel { border-right: 0; }
  .asset-list { max-height: 360px; border-bottom: 1px solid var(--line); }
  .reader-panel { min-height: 400px; }
  .reader-empty { min-height: 360px; }
  .reader-head, .reader-body { padding-left: 20px; padding-right: 20px; }
  .reader-head h2 { font-size: 24px; overflow-wrap: anywhere; }
  .reader-head p { overflow-wrap: anywhere; }
  .reader-body { overflow-wrap: anywhere; font-size: 16px; }
  .reader-body table { display: block; overflow-x: auto; white-space: nowrap; }
  .annotation-panel { padding-left: 20px; padding-right: 20px; }
  .annotation-footer { align-items: flex-start; flex-wrap: wrap; gap: 10px; }
}
