/* ============================================================
   布局层：三栏 / 移动端
   ============================================================ */
.shell {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 22px 28px 34px;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr) 300px;
  gap: 28px;
  align-items: start;
}
.shell.no-rail { grid-template-columns: 230px minmax(0, 1fr); }

.main { min-width: 0; }

/* ---------- 侧边栏 ---------- */
.sidebar {
  position: sticky;
  top: 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 2px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 20px;
}
.brand-mark {
  width: 43px;
  height: 43px;
  flex: none;
  border-radius: 14px;
  background: #4e805d;
  display: grid;
  place-items: center;
  color: #f4efe3;
  box-shadow: 0 10px 18px -12px rgba(35, 76, 64, 0.8);
  position: relative;
  overflow: hidden;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transform: scale(1.14);
}
.brand-mark::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: radial-gradient(circle at 72% 18%, rgba(255, 255, 255, 0.2), transparent 50%);
  pointer-events: none;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name {
  display: flex;
  align-items: baseline;
  gap: 3px;
  font-family: var(--sans);
  font-size: 17.5px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--ink);
  white-space: nowrap;
}
.brand-name b { font-weight: 800; }
.brand-name em {
  font-style: normal;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
}
.brand-sub {
  margin-top: 3px;
  font-size: 8.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--muted);
  white-space: nowrap;
}
.nav-label {
  padding: 14px 12px 6px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--muted-2);
  text-transform: uppercase;
}
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-nav.scroll { overflow-y: auto; min-height: 0; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 13px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.nav-item .ic { width: 19px; height: 19px; opacity: 0.78; }
.nav-item:hover { background: rgba(47, 99, 83, 0.065); }
.nav-item:active { transform: scale(0.985); }
.nav-item.is-on {
  background: var(--green);
  color: #fbf7ef;
  font-weight: 600;
  box-shadow: 0 12px 22px -16px rgba(35, 76, 64, 0.9);
}
.nav-item.is-on .ic { opacity: 1; }
.nav-item.is-on::after {
  content: "";
  position: absolute;
  right: 13px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 252, 246, 0.65);
}
.nav-badge {
  margin-left: auto;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: 99px;
  background: var(--peach);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
}
.nav-item.is-on .nav-badge { background: rgba(255, 255, 255, 0.22); }

.side-foot { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; padding-top: 0; }

.role-card {
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 246, 0.6);
}
.role-card .role-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.role-card .role-head span:last-child { color: var(--green); letter-spacing: 0; font-size: 9.5px; }
.role-card .seg button { font-size: 10.5px; padding: 5px 4px; }

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-soft);
}
.user-card .user-name { font-size: 12.5px; font-weight: 600; line-height: 1.3; }
.user-card .user-meta { font-size: 10px; color: var(--muted); margin-top: 2px; }
.user-card .user-points {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10.5px;
  font-weight: 700;
  color: #9a6a1d;
  background: var(--honey-soft);
  padding: 4px 7px;
  border-radius: 8px;
}
.user-card .user-points .ic { width: 11px; height: 11px; }

.demo-note {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  font-size: 9.5px;
  color: var(--muted-2);
  letter-spacing: 0.04em;
}
.demo-note::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--honey);
}

/* ---------- 主区域 ---------- */
.main { padding-top: 4px; }
.view { animation: rise 0.45s var(--ease) both; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 8px 0 22px;
}
.page-head .head-copy { min-width: 0; }
.page-head h1 {
  margin-top: 6px;
  font-family: var(--serif);
  font-size: clamp(28px, 2.6vw, 36px);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.28;
}
.page-head .sub {
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.7;
  max-width: 46em;
}
.page-actions { display: flex; align-items: center; gap: 8px; flex: none; }

/* ---------- 右栏 ---------- */
.rail {
  position: sticky;
  top: 22px;
  display: flex;
  flex-direction: column;
  gap: 15px;
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.rail-card {
  padding: 17px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow-soft);
}
.rail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}
.rail-head h3 { font-size: 12.5px; font-weight: 700; letter-spacing: 0.01em; }
.rail-head .tiny { color: var(--muted); }
.rail-task {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.rail-task:last-child { border-bottom: 0; padding-bottom: 2px; }
.rail-task .rt-ico {
  width: 29px;
  height: 29px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: var(--green-mist);
  color: var(--green);
  flex: none;
}
.rail-task .rt-ico .ic { width: 15px; height: 15px; }
.rail-task .rt-title { font-size: 11.5px; font-weight: 500; line-height: 1.35; }
.rail-task .rt-sub { font-size: 9.5px; color: var(--muted); margin-top: 1px; }
.rail-task .rt-points { margin-left: auto; font-size: 10px; font-weight: 700; color: #9a6a1d; white-space: nowrap; }
.rail-task.is-done .rt-ico { background: var(--green); color: #fff; }
.rail-task.is-done .rt-title { color: var(--muted); text-decoration: line-through; }

.rail-doc { display: flex; align-items: center; gap: 9px; padding: 8px 0; }
.rail-doc + .rail-doc { border-top: 1px dashed var(--line); }
.rail-doc .rd-name { font-size: 11.5px; font-weight: 600; }
.rail-doc .rd-sub { font-size: 9.5px; color: var(--muted); }
.rail-doc .rd-fans { margin-left: auto; font-size: 9.5px; color: var(--muted); }
.rail-doc .av-online { border-color: var(--card); }

.rail-topics { display: flex; flex-wrap: wrap; gap: 6px; }
.rail-topics .topic {
  padding: 5px 9px;
  border-radius: 8px;
  background: rgba(31, 48, 42, 0.045);
  font-size: 10.5px;
  color: var(--ink-2);
  transition: background 0.2s;
}
.rail-topics .topic:hover { background: var(--green-soft); color: var(--green); }

.rail-quote {
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, #2c5c4d, #1d4036);
  color: #f3eee2;
  border: 0;
}
.rail-quote .quote-mark {
  font-family: var(--serif);
  font-size: 64px;
  line-height: 0.7;
  opacity: 0.28;
  display: block;
  margin-bottom: 6px;
}
.rail-quote p { font-family: var(--serif); font-size: 13.5px; line-height: 1.75; position: relative; z-index: 1; }
.rail-quote .quote-from { margin-top: 10px; font-size: 10px; opacity: 0.65; }
.rail-quote::after {
  content: "";
  position: absolute;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: rgba(232, 131, 78, 0.16);
  right: -50px;
  bottom: -60px;
}

/* ---------- 移动端顶栏 / 底栏 ---------- */
.mobilebar { display: none; }
.tabbar { display: none; }

.site-foot {
  margin-top: 34px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1.7;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}
.site-foot .foot-links { display: flex; gap: 14px; white-space: nowrap; }

/* ---------- 响应式 ---------- */
@media (max-width: 1250px) {
  .shell { grid-template-columns: 222px minmax(0, 1fr); gap: 24px; max-width: 1120px; }
  .rail { display: none; }
  .shell.no-rail { grid-template-columns: 222px minmax(0, 1fr); }
}

@media (max-width: 900px) {
  body { background-attachment: scroll; }
  .shell, .shell.no-rail {
    display: block;
    max-width: 760px;
    padding: 0 14px calc(102px + env(safe-area-inset-bottom));
  }
  .sidebar { display: none; }
  .main { padding-top: 0; }

  .mobilebar {
    display: flex;
    align-items: center;
    gap: 4px;
    position: sticky;
    top: 0;
    z-index: 55;
    margin: 0 -14px;
    padding: 10px 14px;
    background: rgba(244, 240, 231, 0.82);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border-bottom: 1px solid rgba(31, 48, 42, 0.06);
  }
  .mobilebar .brand { padding: 0; gap: 9px; flex: 1; min-width: 0; }
  .mobilebar .brand-mark { width: 33px; height: 33px; border-radius: 11px; }
  .mobilebar .brand-name { font-size: 15.5px; }
  .mobilebar .brand-name em { font-size: 9px; }
  .mobilebar .m-actions { display: flex; align-items: center; gap: 2px; flex: none; }
  .mobilebar .points-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 9px;
    border-radius: 99px;
    background: var(--honey-soft);
    color: #8a631f;
    font-size: 10.5px;
    font-weight: 700;
    margin-right: 2px;
  }
  .mobilebar .points-pill .ic { width: 12px; height: 12px; }
  .mobilebar .icon-btn { width: 34px; height: 34px; position: relative; }
  .mobilebar .icon-btn .ic { width: 20px; height: 20px; }
  .mobilebar .notif-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--peach);
    box-shadow: 0 0 0 2px var(--paper);
  }

  .page-head { margin: 14px 0 18px; align-items: flex-start; }
  .page-head h1 { font-size: 27px; }
  .page-head .sub { font-size: 12px; }
  .page-actions .btn { padding: 9px 13px; font-size: 11.5px; }
  .page-actions .btn .ic { width: 15px; height: 15px; }

  .section-head h2 { font-size: 21px; }
  .site-foot { flex-direction: column; gap: 6px; padding-bottom: 6px; }

  .tabbar {
    display: flex;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 60;
    padding: 7px 6px;
    border-radius: 22px;
    border: 1px solid rgba(31, 48, 42, 0.08);
    background: rgba(255, 252, 246, 0.94);
    backdrop-filter: blur(18px) saturate(1.2);
    -webkit-backdrop-filter: blur(18px) saturate(1.2);
    box-shadow: 0 20px 44px -22px rgba(31, 48, 42, 0.5);
  }
  .tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 4px 0;
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 500;
    border-radius: 14px;
    transition: color 0.2s, background 0.2s;
  }
  .tabbar a .ic { width: 21px; height: 21px; }
  .tabbar a.is-on { color: var(--green); background: var(--green-mist); }
  .tabbar a.is-on .ic { stroke-width: 2; }
}

@media (max-width: 400px) {
  .mobilebar .brand-name em { display: none; }
  .mobilebar .brand-name { font-size: 15px; }
  .page-actions .btn span { display: none; }
  .page-actions .btn { padding: 9px 11px; }
}

@media (max-width: 420px) {
  .shell { padding-inline: 12px; }
  .mobilebar { margin-inline: -12px; padding-inline: 12px; }
  .page-head h1 { font-size: 25px; }
  .tabbar { left: 10px; right: 10px; }
}
