* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; background: #f0f2f5; color: #333; min-height: 100vh; }
a { color: #1a73e8; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Nav */
.nav { background: #2c3e50; color: #fff; }
.nav-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; gap: 16px; padding: 12px 16px; flex-wrap: wrap; }
.nav-brand { color: #fff; font-weight: bold; font-size: 18px; text-decoration: none; white-space: nowrap; }
.nav-link { color: #ccc; text-decoration: none; font-size: 14px; white-space: nowrap; }
.nav-link:hover { color: #fff; text-decoration: none; }
.nav-spacer { flex: 1; }
.nav-user { font-size: 14px; color: #ccc; white-space: nowrap; }
/* 顶栏业务链接容器：桌面 display:contents，子链接直接参与 .nav-inner 布局（视觉与旧版一致） */
.nav-links { display: contents; }
.nav-guest-login { margin-left: auto; }
/* 头像下拉菜单（个人中心/会员中心/退出） */
.nav-menu { position: relative; flex: none; }
.nav-menu-btn { display: inline-flex; align-items: center; gap: 6px; background: none; border: 1px solid transparent; border-radius: 6px; color: #ccc; cursor: pointer; font-size: 14px; padding: 3px 8px; max-width: 200px; font-family: inherit; }
.nav-menu-btn:hover { background: rgba(255,255,255,0.1); color: #fff; border-color: rgba(255,255,255,0.25); }
.nav-menu-avatar { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; flex: none; background: rgba(255,255,255,0.18); }
.nav-menu-avatar-text { display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; line-height: 1; }
.nav-menu-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-menu-caret { font-size: 10px; opacity: .7; flex: none; }
.nav-menu-panel { display: none; position: absolute; right: 0; top: calc(100% + 8px); min-width: 150px; background: #fff; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,0.18); padding: 6px; z-index: 1000; }
.nav-menu.open .nav-menu-panel { display: block; }
.nav-menu-item { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 6px; font-size: 14px; color: #333; text-decoration: none; background: none; border: none; cursor: pointer; font-family: inherit; line-height: 1.4; }
a.nav-menu-item:hover, .nav-menu-item-action:hover { background: #f2f4f7; text-decoration: none; }
.nav-menu-item-action { color: #c0392b; }
.nav-menu-item-action:hover { color: #c0392b; }
.nav-menu-sep { height: 1px; background: #eee; margin: 6px 4px; }
/* 描边按钮：默认用于浅色背景（卡片/弹窗）；深色导航栏由 .nav 规则覆盖回白字白框 */
.btn-outline { background: #fff; border: 1px solid #c9d1d9; color: #333; padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.btn-outline:hover { background: #f2f4f7; border-color: #adb5bd; }
/* .btn{border:none} 排在后面会把 .btn.btn-outline 的描边吃掉，用双类选择器锁定优先级 */
.btn.btn-outline { background: #fff; border: 1px solid #c9d1d9; color: #333; }
.btn.btn-outline:hover { background: #f2f4f7; border-color: #adb5bd; }
.nav .btn-outline { background: none; border-color: #fff; color: #fff; }
.nav .btn-outline:hover { background: rgba(255,255,255,0.1); }
/* 危险操作描边变体（如"退出宗族"）：白底红字红框，悬停填充红底白字；与 .btn.btn-outline 同优先级、靠后覆盖 */
.btn.btn-outline-danger { background: #fff; border: 1px solid #dc2626; color: #dc2626; }
.btn.btn-outline-danger:hover { background: #dc2626; border-color: #dc2626; color: #fff; }

.main { max-width: 1100px; margin: 0 auto; padding: 16px; }

.card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }
.card-title { font-size: 22px; text-align: center; margin-bottom: 20px; }

.form-group { margin-bottom: 12px; }
.form-label { display: block; margin-bottom: 4px; font-size: 13px; color: #555; }
.form-input { width: 100%; padding: 8px 12px; border: 1px solid #ddd; border-radius: 4px; font-size: 14px; font-family: inherit; }
.form-input:focus { outline: none; border-color: #1a73e8; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn { padding: 8px 16px; border: none; border-radius: 4px; cursor: pointer; font-size: 14px; font-family: inherit; }
.btn-primary { background: #1a73e8; color: #fff; }
.btn-primary:hover { background: #1557b0; }
.btn-success { background: #34a853; color: #fff; }
.btn-success:hover { background: #2d8f47; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: #f5f5f5; border: 1px solid #ddd; }
.btn-secondary:hover { background: #e8e8e8; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-link { background: none; border: none; cursor: pointer; font-size: 14px; font-family: inherit; }

.alert { padding: 10px 14px; border-radius: 4px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #dc2626; }
.alert-info { background: #eff6ff; color: #1a73e8; }

.nav-dropdown { position: relative; display: inline-block; }
.dropdown-menu { position: absolute; top: 100%; left: 0; background: #fff; border: 1px solid #ddd; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); z-index: 100; min-width: 160px; }
.dropdown-item { display: block; padding: 8px 16px; color: #333; text-decoration: none; font-size: 14px; white-space: nowrap; }
.dropdown-item:hover { background: #f5f5f5; text-decoration: none; }
.badge { display: inline-block; background: #dc2626; color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 10px; margin-left: 4px; }
.pending-badge { display: inline-block; background: #f59e0b; color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 4px; }
.approved-badge { display: inline-block; background: #34a853; color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 4px; }
.rejected-badge { display: inline-block; background: #dc2626; color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 4px; }

.table { width: 100%; border-collapse: collapse; }
.table th { padding: 10px 12px; font-size: 14px; background: #fafafa; border-bottom: 2px solid #eee; text-align: left; }
.table td { padding: 10px 12px; font-size: 14px; border-bottom: 1px solid #f0f0f0; text-align: left; }
.table th.num, .table td.num, .table th.center, .table td.center { text-align: center; }
.table th.action, .table td.action { text-align: center; }
.table th.right, .table td.right { text-align: right; }
.table tr:hover { background: #fafafa; }

/* Public page header */
.hero { background: linear-gradient(135deg, #2c3e50, #3498db); color: #fff; padding: 40px 20px; text-align: center; margin-bottom: 24px; border-radius: 8px; }
.hero h1 { font-size: 28px; margin-bottom: 8px; }
.hero p { font-size: 16px; opacity: 0.9; }
.clan-card { background: #fff; border-radius: 8px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); transition: box-shadow 0.2s; }
.clan-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.clan-card h3 { font-size: 18px; margin-bottom: 8px; }
.clan-card p { font-size: 14px; color: #666; margin-bottom: 12px; }
.clan-meta { font-size: 13px; color: #888; display: flex; gap: 16px; }

/* Member tree node */
.tree-node { padding: 10px 0; border-bottom: 1px solid #f0f0f0; }
.tree-node:last-child { border-bottom: none; }

/* Tree connector lines */
.tree-view { padding: 16px; }
.tree-view ul { list-style: none !important; padding: 0 !important; margin: 0 !important; }
.tree-view ul ul { margin-left: 28px !important; }
.tree-view li { position: relative !important; display: block !important; padding: 4px 0 4px 20px !important; list-style: none !important; }
.tree-view > ul > li { padding-left: 0 !important; }
.tree-view ul ul li::before {
  content: '' !important;
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  bottom: 0 !important;
  width: 1px !important;
  background: #c0c0c0 !important;
}
.tree-view ul ul li:last-child::before {
  height: var(--card-center, 26px) !important;
  bottom: auto !important;
}
.tree-view .tree-item:not(.tree-item-root) > .tree-node-card::before {
  content: '' !important;
  position: absolute !important;
  left: -22px !important;
  top: 50% !important;
  width: 22px !important;
  height: 1px !important;
  background: #c0c0c0 !important;
}

.tree-node-card { display: inline-flex !important; position: relative !important; align-items: center; gap: 6px; padding: 6px 14px; background: #fff; border: 2px solid #e0e0e0; border-radius: 6px; cursor: pointer; transition: border-color .15s; }
.tree-node-card:hover { border-color: #1a73e8; }

/* Empty state */
.empty-state { text-align: center; padding: 80px 20px; }

/* Login page */
.login-container { display: flex; align-items: center; justify-content: center; min-height: 80vh; }
.login-card { width: 100%; max-width: 420px; }
.wechat-btn { width: 100%; padding: 12px; background: #07c160; color: #fff; border: none; border-radius: 4px; font-size: 16px; cursor: pointer; margin-top: 12px; }
.wechat-btn:hover { background: #06ad56; }
.wechat-btn:disabled { background: #ccc; cursor: not-allowed; }
.divider { text-align: center; margin: 16px 0; position: relative; color: #999; font-size: 13px; }
.divider::before, .divider::after { content: ''; position: absolute; top: 50%; width: 40%; height: 1px; background: #ddd; }
.divider::before { left: 0; }
.divider::after { right: 0; }

/* Responsive */
@media (max-width: 768px) {
  .nav-inner { gap: 10px; padding: 10px 12px; }
  .nav-brand { font-size: 16px; order: 1; }
  .nav-link { font-size: 13px; }
  /* 手机端顶栏固定两行：第一行=品牌 + 头像菜单（右靠），第二行=业务链接自动换行；
     不加汉堡菜单，靠 order/flex-basis 强制断行，链接再多也不会挤成一团乱 */
  .nav-menu { order: 2; margin-left: auto; }
  .nav-guest-login { order: 2; }
  .nav-links { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; order: 3; flex-basis: 100%; }
  .nav-spacer { display: none; }
  .nav-menu-name { max-width: 96px; }
  .nav-clan-current { max-width: 40vw; }
  .main { padding: 12px; }
  .card { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .table { font-size: 13px; }
  .table th, .table td { padding: 8px; }
  .hero { padding: 24px 16px; }
  .hero h1 { font-size: 22px; }
  .hero p { font-size: 14px; }
}

@media (max-width: 480px) {
  .nav-inner { flex-wrap: wrap; }
  .nav-spacer { display: none; }
  .nav-user { font-size: 12px; }
  .nav-menu-name { display: none; }
  .nav-clan-current { max-width: 34vw; }
  .clan-meta { flex-direction: column; gap: 4px; }
}

/* ===== 新手引导（base.html onboarding：欢迎弹窗 + 聚光灯 + FAB） ===== */
#obFab { position: fixed; right: 16px; bottom: 96px; width: 44px; height: 44px; border-radius: 50%; background: #1a73e8; color: #fff; font-size: 20px; border: none; box-shadow: 0 4px 12px rgba(26,115,232,.35); cursor: pointer; z-index: 99980; display: flex; align-items: center; justify-content: center; padding: 0; line-height: 1; transition: transform .15s ease, background .15s ease; }
#obFab:hover { background: #1663c7; transform: translateY(-2px); }
.ob-mask { position: fixed; inset: 0; z-index: 249999; }
.ob-spot { position: fixed; z-index: 250000; border: 2px solid #1a73e8; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(15,23,42,.62); pointer-events: none; transition: left .18s ease, top .18s ease, width .18s ease, height .18s ease; }
.ob-tip { position: fixed; z-index: 250001; width: min(340px, calc(100vw - 24px)); background: #fff; border-radius: 12px; box-shadow: 0 10px 34px rgba(0,0,0,.28); padding: 14px 16px; box-sizing: border-box; }
.ob-tip-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.ob-tip-head b { font-size: 15px; color: #1a2733; }
.ob-tip-idx { font-size: 12px; color: #8a94a6; white-space: nowrap; }
.ob-tip-body { font-size: 13px; color: #445; line-height: 1.65; margin-bottom: 12px; }
.ob-tip-btns { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ob-tip-btns .btn { white-space: nowrap; flex: 0 0 auto; }
.ob-tip-space { flex: 1 1 auto; min-width: 4px; }
.ob-tip-note { font-size: 11.5px; color: #8a94a6; line-height: 1.55; margin: -4px 0 10px; }
.ob-btn-quit { background: none; border: none; padding: 2px 4px; font-size: 12px; color: #98a2b3; text-decoration: underline; cursor: pointer; flex: 0 0 auto; line-height: 1.4; }
.ob-btn-quit:hover { color: #d93025; }
.ob-welcome-mask { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 250000; display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
.ob-welcome-card { width: min(480px, 100%); max-height: 88vh; overflow: auto; background: #fff; border-radius: 14px; padding: 22px 22px 18px; box-shadow: 0 18px 50px rgba(0,0,0,.3); box-sizing: border-box; }
.ob-welcome-brand { font-size: 20px; font-weight: 700; color: #1a2733; margin-bottom: 6px; }
.ob-welcome-sub { font-size: 13px; color: #667; margin-bottom: 14px; }
.ob-welcome-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-bottom: 12px; }
.ob-welcome-grid > div { background: #f8fafc; border: 1px solid #eef1f5; border-radius: 10px; padding: 12px; }
.ob-welcome-grid i { font-style: normal; font-size: 20px; display: block; margin-bottom: 4px; }
.ob-welcome-grid b { font-size: 14px; color: #1a2733; display: block; margin-bottom: 3px; }
.ob-welcome-grid span { font-size: 12px; color: #667; line-height: 1.55; display: block; }
.ob-welcome-tip { font-size: 12px; color: #5b4a8a; background: #f3f0fb; border-radius: 8px; padding: 9px 11px; line-height: 1.6; margin-bottom: 14px; }
.ob-welcome-btns { display: flex; justify-content: flex-end; gap: 10px; }
@media (max-width: 768px) {
  #obFab { right: 12px; bottom: 84px; width: 40px; height: 40px; font-size: 18px; }
  .ob-welcome-card { padding: 18px 16px 14px; }
}
