:root {
  --ink: #18211f;
  --muted: #746b66;
  --paper: #ffffff;
  --panel: #fffefb;
  --line: #e3d8ca;
  --green: #2f6f5e;
  --green-2: #e4f0eb;
  --red: #a33b2e;
  --gold: #9f6b2b;
  --blue: #37616b;
  --shadow: 0 16px 42px rgba(82, 55, 39, 0.09);
  --sidebar-width: 210px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--ink);
  background: #f6f8f7;
  font-family: "Microsoft YaHei UI", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.65;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
.shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; padding: 24px 18px;
  border-right: 1px solid var(--line); background: rgba(255, 253, 247, .9);
  display: flex; flex-direction: column;
}
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 28px; color: inherit; }
.brand:hover { text-decoration: none; }
.brand strong { display: block; font-size: 18px; }
.brand small { display: block; color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a {
  display: block; padding: 9px 12px; border-radius: 8px; color: var(--ink);
  font-weight: 600;
}
.nav a.active, .nav a:hover { color: var(--green); background: var(--green-2); text-decoration: none; }
.nav-user {
  margin-top: auto; padding: 10px 12px; font-size: 13px; color: var(--muted);
  border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 8px; align-items: center;
}
.main { padding: 28px 32px; max-width: 1080px; width: 100%; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.page-head h1 { margin: 0 0 4px; font-size: 24px; }
.page-head .eyebrow { margin: 0 0 2px; color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.page-head p { margin: 0; color: var(--muted); }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  padding: 20px 22px; margin-bottom: 18px; box-shadow: 0 1px 4px rgba(36, 79, 69, .05);
}
.card h2 { margin: 0 0 10px; font-size: 17px; }
.card h3 { margin: 14px 0 6px; font-size: 15px; }
.muted { color: var(--muted); font-size: 13px; }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px;
  background: white; color: var(--ink); font-weight: 700; font-size: 14px; cursor: pointer;
  white-space: nowrap;
}
.button:hover { text-decoration: none; filter: brightness(.97); }
.button.primary { border-color: var(--green); background: var(--green); color: white; }
.button.ghost { background: var(--panel); }
.button.small { min-height: 30px; padding: 0 10px; font-size: 13px; }
.button.danger { border-color: #d9b3ac; background: #fdf1ef; color: var(--red); }
.button[disabled] { opacity: .5; cursor: not-allowed; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; background: white;
  color: var(--ink); font: inherit;
}
input, select { height: 38px; padding: 0 10px; }
textarea { padding: 10px 12px; line-height: 1.7; resize: vertical; }
label span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 700; }
.form-grid { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check-line input { width: auto; height: auto; }
.flash-stack { margin-bottom: 16px; display: grid; gap: 8px; }
.flash { padding: 10px 14px; border-radius: 8px; font-size: 14px; border: 1px solid; }
.flash.error { background: #fdf1ef; border-color: #e5c1bb; color: var(--red); }
.flash.success { background: var(--green-2); border-color: #b9d8cc; color: var(--green); }
.badge {
  display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px;
  font-weight: 700; background: var(--green-2); color: var(--green);
}
.badge.gray { background: #eef0ee; color: var(--muted); }
.badge.gold { background: #f7ecd9; color: var(--gold); }
.badge.red { background: #fdf1ef; color: var(--red); }
.badge.blue { background: #e6eff1; color: var(--blue); }
.project-list { display: grid; gap: 10px; }
.project-item {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: white;
}
.project-item:hover { border-color: var(--green); }
.project-item .title { font-weight: 700; font-size: 16px; color: inherit; }
.project-item .meta { color: var(--muted); font-size: 13px; }
.chapter-list { display: grid; gap: 6px; margin-top: 8px; }
.chapter-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: white; font-size: 14px;
}
.chapter-row .num { color: var(--muted); width: 46px; flex: none; }
.chapter-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prose { white-space: pre-wrap; line-height: 1.9; font-size: 15px; }
.prose-box { background: white; border: 1px solid var(--line); border-radius: 10px; padding: 18px 22px; }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tabs a { padding: 6px 14px; border-radius: 8px; border: 1px solid var(--line); background: white; color: var(--ink); font-size: 14px; font-weight: 600; }
.tabs a.active { background: var(--green); border-color: var(--green); color: white; text-decoration: none; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data th { color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stat-pill { display: inline-flex; gap: 6px; align-items: baseline; padding: 6px 12px; border-radius: 8px; background: white; border: 1px solid var(--line); font-size: 13px; }
.stat-pill strong { font-size: 16px; color: var(--green); }
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 420px; padding: 32px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow); }
.login-brand { margin-bottom: 22px; }
.login-brand strong { display: block; font-size: 20px; }
.login-brand small { color: var(--muted); font-size: 12px; }
.login-card h1 { margin: 0 0 6px; font-size: 22px; }
.login-card .subtle { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.login-card .field { display: block; margin-bottom: 14px; }
.login-card button { width: 100%; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-user { margin-top: 8px; border-top: 0; }
  .main { padding: 18px; }
}
