* { 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; }
.btn-outline { background: none; border: 1px solid #fff; color: #fff; padding: 4px 12px; border-radius: 4px; cursor: pointer; font-size: 13px; }
.btn-outline:hover { background: rgba(255,255,255,0.1); }

.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; text-align: left; font-size: 13px; background: #fafafa; border-bottom: 2px solid #eee; }
.table td { padding: 10px 12px; font-size: 14px; border-bottom: 1px solid #f0f0f0; }
.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; }
  .nav-link { font-size: 13px; }
  .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; }
  .clan-meta { flex-direction: column; gap: 4px; }
}
