/* ============================================================
   留叙拾忆 · 社交页面通用组件
   宗族成员 / 群组留言 / 好友伙伴 / 个人中心
   ============================================================ */

.subpage {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page-nav {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.nav-back {
  width: 32px;
  height: 32px;
  margin-left: -6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-back:active { background: rgba(122, 106, 88, 0.08); }

.nav-title {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-indent: 0.12em;
  color: var(--text);
  white-space: nowrap;
}

.nav-side {
  margin-left: auto;
  height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(122, 106, 88, 0.28);
  border-radius: 3px;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 9.5px;
  letter-spacing: 0.02em;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nav-side:active { background: rgba(122, 106, 88, 0.07); }

.page-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 20px 26px;
  scrollbar-width: none;
}

.page-body::-webkit-scrollbar { display: none; }

/* ---------- 搜索 ---------- */

.searchbar {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(122, 106, 88, 0.15);
  border-radius: var(--radius);
  background: #FCFAF5;
  box-shadow: 0 1px 2px rgba(95, 78, 54, 0.04);
}

.searchbar:focus-within { border-color: rgba(122, 106, 88, 0.34); }

.searchbar .s-icon {
  flex: 0 0 auto;
  display: flex;
  color: var(--ink-soft);
}

.searchbar input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text);
}

.searchbar input::placeholder { color: #A9A091; }

.searchbar .s-clear {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #A9A091;
  display: flex;
  align-items: center;
  justify-content: center;
}

.searchbar .s-clear[hidden] { display: none; }

/* ---------- 头像 / 身份标签 ---------- */

.avatar-mono {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 1px solid rgba(122, 106, 88, 0.18);
  border-radius: 50%;
  background:
    radial-gradient(120% 100% at 30% 18%, #FAF5EB 0%, rgba(250, 245, 235, 0) 64%),
    linear-gradient(155deg, #F3EBDE 0%, #E7DCC9 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 16px;
  color: var(--ink);
  user-select: none;
}

.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 13px;
}

.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 22px;
}

.id-tag {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 4px;
  border: 1px solid rgba(122, 106, 88, 0.3);
  border-radius: 2px;
  font-family: var(--font-sans);
  font-size: 8px;
  line-height: 1.35;
  letter-spacing: 0.01em;
  color: var(--ink);
  white-space: nowrap;
}

.id-tag.is-guest {
  border-color: rgba(122, 106, 88, 0.2);
  color: #A2957F;
}

.id-tag.is-friend {
  border-color: rgba(160, 128, 86, 0.34);
  color: #8F6F47;
}

.admin-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 14px;
  height: 13px;
  padding: 0 2px;
  border-radius: 2px;
  background: var(--ink);
  color: #FBF7EF;
  font-family: var(--font-sans);
  font-size: 7.5px;
  line-height: 1;
  letter-spacing: 0.02em;
}

.elder-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 13px;
  padding: 0 3px;
  border: 1px solid rgba(122, 106, 88, 0.36);
  border-radius: 2px;
  background: rgba(122, 106, 88, 0.06);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 7.5px;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* ---------- 列表 / 卡片 ---------- */

.list-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid rgba(122, 106, 88, 0.13);
  border-radius: var(--radius);
  background: var(--paper-card);
  box-shadow: 0 1px 2px rgba(95, 78, 54, 0.04);
  text-align: left;
}

.list-card:active { background: #F6EFE3; }

.list-main { flex: 1; min-width: 0; }

.list-name-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.list-name {
  font-family: var(--font-serif);
  font-size: 14px;
  letter-spacing: 0.03em;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-sub {
  margin: 3px 0 0;
  font-family: var(--font-sans);
  font-size: 9px;
  line-height: 1.5;
  color: #A9A091;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-chev {
  flex: 0 0 auto;
  display: flex;
  color: #C3B7A4;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 16px 0 8px;
}

.section-head:first-child { margin-top: 0; }

.section-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  color: var(--text);
}

.section-count {
  font-family: var(--font-sans);
  font-size: 8.5px;
  letter-spacing: 0.02em;
  color: #A9A091;
}

.section-link {
  font-family: var(--font-sans);
  font-size: 9.5px;
  color: var(--ink);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
}

/* ---------- 设置动作行 ---------- */

.action-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 12px;
  border: 1px solid rgba(122, 106, 88, 0.13);
  border-radius: var(--radius);
  background: var(--paper-card);
  box-shadow: 0 1px 2px rgba(95, 78, 54, 0.04);
  text-align: left;
}

.action-row + .action-row { margin-top: 8px; }
.action-row:active { background: #F6EFE3; }

.action-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(122, 106, 88, 0.16);
  border-radius: 50%;
  background: #F6EFE2;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
}

.action-main { flex: 1; min-width: 0; }

.action-title {
  display: block;
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text);
}

.action-desc {
  display: block;
  margin-top: 3px;
  font-family: var(--font-sans);
  font-size: 8.5px;
  line-height: 1.5;
  color: #A9A091;
}

/* ---------- 弹层 ---------- */

.sheet-layer {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: flex-end;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.26s ease, visibility 0.26s ease;
}

.sheet-layer.is-open { opacity: 1; visibility: visible; }

.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(45, 38, 30, 0.36);
}

.sheet {
  position: relative;
  width: 100%;
  max-height: 86%;
  display: flex;
  flex-direction: column;
  padding: 10px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  background: #FAF6EE;
  border-top: 1px solid rgba(122, 106, 88, 0.12);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 40px rgba(60, 48, 32, 0.14);
  transform: translateY(104%);
  transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.sheet-layer.is-open .sheet { transform: translateY(0); }

.sheet-handle {
  flex: 0 0 auto;
  width: 36px;
  height: 4px;
  margin: 0 auto 11px;
  border-radius: 2px;
  background: #DCD1BF;
}

.sheet-head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(122, 106, 88, 0.1);
}

.sheet-head h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--text);
}

.sheet-close {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #8C8375;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sheet-close:active { background: rgba(122, 106, 88, 0.08); }

.sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 0 4px;
  scrollbar-width: none;
}

.sheet-body::-webkit-scrollbar { display: none; }

.sheet-foot {
  flex: 0 0 auto;
  display: flex;
  gap: 10px;
  padding-top: 11px;
  border-top: 1px solid rgba(122, 106, 88, 0.1);
}

.field-label {
  display: block;
  margin-bottom: 5px;
  font-family: var(--font-sans);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: #8C8375;
}

.field-input,
.field-select,
.field-area {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(122, 106, 88, 0.16);
  border-radius: 3px;
  outline: none;
  background: #FCFAF5;
  font-family: var(--font-sans);
  font-size: 11.5px;
  color: var(--text);
}

.field-area { min-height: 64px; resize: none; line-height: 1.7; }

.field-select {
  -webkit-appearance: none;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #A2957F 50%),
    linear-gradient(135deg, #A2957F 50%, transparent 50%);
  background-position: calc(100% - 13px) 12px, calc(100% - 8px) 12px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 24px;
}

.field-input:focus,
.field-select:focus,
.field-area:focus { border-color: rgba(122, 106, 88, 0.42); }

.field-block { margin-bottom: 12px; }

.hint {
  margin: 6px 0 0;
  font-family: var(--font-sans);
  font-size: 8.5px;
  line-height: 1.6;
  color: #A9A091;
}

.btn-cancel {
  flex: 0 0 82px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(122, 106, 88, 0.3);
  border-radius: var(--radius);
  background: transparent;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--ink);
}

.btn-cancel:active { background: rgba(122, 106, 88, 0.07); }

.sheet-foot .btn-primary {
  flex: 1;
  width: auto;
  height: 44px;
  font-size: 13px;
}

/* ---------- 分段 / 开关 ---------- */

.seg {
  display: flex;
  border: 1px solid rgba(122, 106, 88, 0.25);
  border-radius: 3px;
  overflow: hidden;
}

.seg-btn,
.mode-btn {
  flex: 1;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--ink);
  white-space: nowrap;
}

.seg-btn + .seg-btn,
.mode-btn + .mode-btn { border-left: 1px solid rgba(122, 106, 88, 0.25); }
.seg-btn.is-active,
.mode-btn.is-active { background: var(--ink); color: #FFFFFF; }

.switch {
  position: relative;
  flex: 0 0 36px;
  width: 36px;
  height: 21px;
  border: 0;
  border-radius: 11px;
  padding: 0;
  background: #DED4C4;
  transition: background 0.18s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 1px 2px rgba(60, 48, 32, 0.2);
  transition: transform 0.18s ease;
}

.switch.is-on { background: var(--ink); }
.switch.is-on::after { transform: translateX(15px); }

/* ---------- 空态 / 私域标记 ---------- */

.empty {
  margin: 0;
  padding: 40px 20px;
  text-align: center;
  font-family: var(--font-sans);
  font-size: 10.5px;
  line-height: 1.8;
  color: #A9A091;
}

.privacy-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  font-family: var(--font-sans);
  font-size: 8.5px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: #A9A091;
}

.privacy-line svg { flex: 0 0 auto; }

.view-switch {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(122, 106, 88, 0.16);
}

.view-label {
  display: block;
  margin-bottom: 7px;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
}

.boundary-note {
  margin: 14px 0 0;
  padding-top: 11px;
  border-top: 1px solid rgba(122, 106, 88, 0.12);
  font-family: var(--font-sans);
  font-size: 9.5px;
  line-height: 1.8;
  color: #8C8375;
}

.toast { z-index: 40; }
