/* ========================================
   旧版项目只读页 /legacy-project
   根节点 .wr-page.lp-page，沿用写作页的 --wr-* 变量和 .wr-btn / .wr-card / .wr-badge / .wr-dot / .wr-metrics
   注意：首页 public-home.css 也用 .lp- 前缀（如 .lp-section），新加类名前先查重
   ======================================== */

/* ---------- 顶栏 ---------- */

.lp-page .lp-topbar {
  grid-template-columns: minmax(0, 1fr) auto;
}

.lp-topbar__main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.lp-back {
  flex-shrink: 0;
  color: var(--wr-muted);
}

.lp-back:hover:not(:disabled) {
  color: var(--wr-text);
}

.lp-topbar__title {
  align-items: center;
  gap: 8px;
}

.lp-topbar__title h1 {
  min-width: 0;
}

.lp-badge--muted {
  background: #eef1f5;
  color: var(--wr-muted);
}

.lp-page .wr-btn:disabled {
  cursor: not-allowed;
}

/* ---------- 正文区 ---------- */

.lp-body {
  max-width: 1080px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.lp-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin: 96px auto;
  color: var(--wr-muted);
}

.lp-notice {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px 14px 18px;
  border: 1px solid var(--wr-primary-line);
  border-left: 4px solid var(--wr-primary);
  border-radius: 10px;
  background: var(--wr-primary-soft);
}

.lp-notice p {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  font-weight: 500;
}

.lp-notice .wr-btn {
  flex-shrink: 0;
}

.lp-draft {
  padding: 10px 14px;
  border: 1px solid rgba(180, 83, 9, 0.25);
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-size: 13px;
}

/* ---------- 指标 ---------- */

.lp-page .lp-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
}

.lp-page .lp-metrics > div {
  background: var(--wr-card);
  border: 1px solid var(--wr-border);
  padding: 12px 14px;
}

/* .wr-metrics div 会给所有子 div 加底色和内边距，进度条要压回去 */
.lp-metrics .lp-progress {
  height: 4px;
  padding: 0;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ecf1;
}

.lp-metrics .lp-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--wr-primary);
}

.lp-attach {
  margin-top: -6px;
  color: var(--wr-muted);
  font-size: 12.5px;
}

/* ---------- 目录卡 ---------- */

.lp-outline {
  padding-bottom: 12px;
}

.lp-outline__empty {
  color: var(--wr-faint);
}

.lp-chapters {
  margin: 0;
  padding: 0;
  list-style: none;
}

.lp-chapter + .lp-chapter {
  border-top: 1px solid var(--wr-border);
}

.lp-chapter__head {
  display: grid;
  grid-template-columns: 14px auto minmax(0, 1fr) auto 72px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 6px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--wr-text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.lp-chapter__head:hover {
  background: var(--wr-hover);
}

.lp-chevron {
  color: var(--wr-faint);
  transform: rotate(90deg);
  transition: transform 0.15s ease;
}

.lp-chapter.is-collapsed .lp-chevron {
  transform: none;
}

.lp-chapter__num {
  color: var(--wr-muted);
  font-size: 13px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.lp-chapter__title {
  overflow: hidden;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lp-chapter.is-unwritten .lp-chapter__title {
  color: var(--wr-muted);
}

.lp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 12px;
  white-space: nowrap;
}

.lp-chip.is-done {
  background: rgba(21, 128, 61, 0.08);
  color: var(--wr-ok);
}

.lp-chip.is-partial {
  background: var(--wr-primary-soft);
  color: var(--wr-primary);
}

.lp-chip.is-empty {
  background: #f1f3f6;
  color: var(--wr-faint);
}

/* 写了一部分：半实心圆点 */
.lp-dot--half {
  border-color: var(--wr-primary);
  background: linear-gradient(90deg, var(--wr-primary) 50%, transparent 50%);
}

.lp-words {
  color: var(--wr-muted);
  font-size: 12.5px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.lp-chapter__body {
  padding: 0 6px 12px 30px;
}

.lp-chapter.is-collapsed .lp-chapter__body {
  display: none;
}

.lp-sec + .lp-sec,
.lp-leaf--section + .lp-sec,
.lp-sec + .lp-leaf--section {
  margin-top: 6px;
}

.lp-sec__title {
  padding: 5px 0 3px;
  color: var(--wr-text);
  font-size: 13px;
  font-weight: 500;
}

.lp-leaf {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
  padding: 4px 0 4px 14px;
  font-size: 13px;
}

.lp-leaf--section {
  padding-left: 0;
}

.lp-leaf__title {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lp-leaf.is-unwritten .lp-leaf__title {
  color: var(--wr-faint);
}

.lp-sec--plain .lp-sec__title {
  color: var(--wr-muted);
  font-weight: 400;
}

.lp-plain-item {
  padding: 2px 0 2px 14px;
  color: var(--wr-faint);
  font-size: 12.5px;
}

.lp-export-hint {
  color: var(--wr-muted);
  font-size: 12.5px;
}

/* ---------- 空状态 ---------- */

.lp-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  max-width: 480px;
  margin: 96px auto;
  padding: 40px 32px;
  border: 1px solid var(--wr-border);
  border-radius: var(--wr-radius);
  background: var(--wr-card);
  text-align: center;
}

.lp-empty h2 {
  font-size: 17px;
  font-weight: 600;
}

.lp-empty p {
  color: var(--wr-muted);
}

.lp-empty__actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
