* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* ═══ 主色系 ═══ */
    --primary: #4a90d9;
    --primary-dark: #3a7bc8;
    --primary-light: #e8f0f8;
    --success: #10b981;
    --success-dark: #059669;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* ═══ 背景色 ═══ */
    --bg-main: #f5f7fa;
    --bg-card: #ffffff;
    --bg-header: #ffffff;
    --bg-sidebar: #ffffff;

    /* ═══ 文字色 ═══ */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-white: #ffffff;

    /* ═══ 边框/阴影/圆角 ═══ */
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-sm: 4px;
    --radius-full: 9999px;

    /* ═══ 角色标签色 ═══ */
    --role-guest: #9ca3af;
    --role-guest-bg: #f3f4f6;
    --role-user: #6b7280;
    --role-user-bg: #f3f4f6;
    --role-member: #059669;
    --role-member-bg: #d1fae5;
    --role-admin: #1e40af;
    --role-admin-bg: #dbeafe;
    --role-super-admin: #92400e;
    --role-super-admin-bg: #fef3c7;

    /* ═══ 性别头像色 ═══ */
    --avatar-male-bg: #D6EAFF;
    --avatar-male-fg: #4A9EDE;
    --avatar-female-bg: #FFD6E8;
    --avatar-female-fg: #E85A9A;

    /* ═══ 布局尺寸 ═══ */
    --sidebar-width: 240px;
    --header-height: 56px;
    --tab-bar-height: 56px;
    --content-max-width: 1200px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.hidden { display: none !important; }
.page { min-height: 100vh; }

/* ═══ 图片懒加载 ═══ */
img[data-src] { opacity: 0.3; transition: opacity 0.3s; }
img.lazy-loaded { opacity: 1; }

/* ═══ SVG默认头像样式（性别头像组件） ═══ */
.gender-avatar {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
}
.gender-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}
.gender-avatar.male { background: var(--avatar-male-bg); color: var(--avatar-male-fg); }
.gender-avatar.female { background: var(--avatar-female-bg); color: var(--avatar-female-fg); }
.gender-avatar.guest-hidden { background: var(--avatar-male-bg); color: var(--avatar-male-fg); }

/* ═══ 底部Tab栏（手机端） ═══ */
.bottom-tab-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tab-bar-height);
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    z-index: 500;
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-tab-bar .tab-list {
    display: flex;
    align-items: center;
    justify-content: space-around;
    height: 100%;
    list-style: none;
}
.bottom-tab-bar .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-muted);
    transition: color 0.2s;
    text-decoration: none;
    position: relative;
    padding: 4px 12px;
}
.bottom-tab-bar .tab-item i { font-size: 20px; }
.bottom-tab-bar .tab-item.active { color: var(--primary); }
.bottom-tab-bar .tab-item .tab-badge {
    position: absolute;
    top: 0;
    right: 4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    padding: 1px 5px;
    border-radius: var(--radius-full);
    min-width: 16px;
    text-align: center;
    line-height: 1.3;
}

/* ═══ 电脑端布局 ═══ */
.desktop-layout {
    display: flex;
    min-height: 100vh;
}
.desktop-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s;
}
.desktop-sidebar .sidebar-brand {
    padding: 20px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    text-align: center;
}
.desktop-sidebar .sidebar-nav { list-style: none; padding: 8px 0; }
.desktop-sidebar .sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: var(--text-secondary);
    border-left: 3px solid transparent;
}
.desktop-sidebar .sidebar-nav-item:hover { background: var(--bg-main); color: var(--text-primary); }
.desktop-sidebar .sidebar-nav-item.active { background: var(--primary-light); color: var(--primary); border-left-color: var(--primary); font-weight: 500; }
.desktop-sidebar .sidebar-nav-item i { width: 20px; text-align: center; font-size: 16px; }
.desktop-sidebar .sidebar-nav-item .nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: var(--radius-full);
}
.desktop-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    padding: 20px;
    max-width: calc(100vw - var(--sidebar-width));
}

/* ═══ 公告滚动栏 ═══ */
.announcement-bar {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--warning-light);
    border-radius: var(--radius);
    margin-bottom: 16px;
    gap: 8px;
    cursor: pointer;
    overflow: hidden;
}
.announcement-bar .ann-icon { flex-shrink: 0; font-size: 16px; color: var(--warning); }
.announcement-bar .ann-scroll-area { flex: 1; overflow: hidden; position: relative; }
.announcement-bar .ann-text {
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    display: inline-block;
}
.announcement-bar .ann-text.ann-scrolling {
    animation: annScroll 8s linear infinite;
}
@keyframes annScroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}
.announcement-bar .ann-dots {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}
.announcement-bar .ann-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.4;
    transition: all 0.3s;
}
.announcement-bar .ann-dot.active { opacity: 1; background: var(--warning); }

/* ═══ 我的页面 ═══ */
.me-profile-card { text-align: center; }
.me-profile-top { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.me-avatar-img, .me-avatar-default {
    width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0; cursor: pointer;
}
.me-avatar-img { object-fit: cover; border: 2px solid var(--border-color); }
.me-avatar-default {
    background: var(--avatar-male-bg); color: var(--avatar-male-fg);
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 600;
}
.me-profile-info { flex: 1; text-align: left; }
.me-name-row { display: flex; align-items: center; gap: 8px; }
.me-name { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.me-name-edit { color: var(--text-muted); cursor: pointer; font-size: 14px; }
.me-name-edit:hover { color: var(--primary); }
.me-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.me-info-item { font-size: 13px; }
.me-info-label { color: var(--text-muted); margin-right: 6px; }
.me-info-value { color: var(--text-primary); }

.me-status-card {
    display: flex; align-items: center; gap: 12px; padding: 14px 16px;
}
.me-status-icon { font-size: 24px; flex-shrink: 0; }
.me-status-text { font-size: 13px; color: var(--text-secondary); }
.me-status-unverified { background: var(--warning-light); border-left: 3px solid var(--warning); }
.me-status-verified { background: var(--success-light); border-left: 3px solid var(--success); }

.me-actions-card { display: flex; flex-direction: column; gap: 8px; }
.me-action-btn { text-align: left; justify-content: flex-start; }
.me-logout-btn { color: var(--danger) !important; border-color: var(--danger) !important; }
.me-hint-text { font-size: 12px; color: var(--text-muted); text-align: center; padding: 4px 0; }

.me-desc-content { font-size: 14px; color: var(--text-secondary); line-height: 1.8; white-space: pre-wrap; }
.me-about-card .me-about-info { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-secondary); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-block { width: 100%; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: var(--success-dark); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-guest { background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%); color: white; width: 100%; margin-top: 12px; }
.btn-guest:hover { opacity: 0.9; }
.btn-outline { background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-outline:hover { background: var(--bg-main); }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-action { width: 100%; margin-bottom: 8px; background: #f8f9fa; border: 1px solid var(--border-color); color: var(--text-primary); }
.btn-action:not(:disabled) { background: var(--primary); color: white; border-color: var(--primary); }
.btn-action:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-action.btn-edit:not(:disabled) { background: var(--success); border-color: var(--success); }
.btn-close-panel { padding: 4px 8px; }

.login-container {
    max-width: 400px;
    margin: 60px auto;
    padding: 40px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.login-header { text-align: center; margin-bottom: 30px; }
.login-header .logo-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: white;
}
.login-header h1 { font-size: 24px; color: var(--primary); margin-bottom: 8px; }
.login-header p { color: var(--text-secondary); font-size: 14px; }
.login-form .form-group { margin-bottom: 16px; }
.login-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}
.login-form label i { margin-right: 6px; color: var(--text-muted); }
.login-form input, .login-form select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 15px;
    transition: border-color 0.2s;
}
.login-form input:focus { outline: none; border-color: var(--primary); }
.login-hint { text-align: center; margin-top: 16px; color: var(--text-secondary); font-size: 13px; }

/* 登录Tab切换（手机端） */
.login-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}
.login-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
    text-align: center;
}
.login-tab:hover { color: var(--primary); }
.login-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 500; }

/* 登录区内容（电脑端横向分栏） */
.login-body {
    display: flex;
    gap: 24px;
    align-items: stretch;
}
.login-divider {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
    position: relative;
    padding: 0 8px;
}
.login-divider::before,
.login-divider::after {
    content: '';
    position: absolute;
    width: 1px;
    background: var(--border-color);
    left: 50%;
}
.login-divider::before { top: 0; bottom: 55%; }
.login-divider::after { top: 45%; bottom: 0; }

/* 微信扫码样式 */
.wechat-qr-container { text-align: center; }
.wechat-qr-placeholder { padding: 20px; }
.wechat-icon-lg { font-size: 48px; color: #07c160; margin-bottom: 12px; }
.btn-wechat { background: #07c160; color: white; border: none; padding: 10px 20px; border-radius: var(--radius); cursor: pointer; font-size: 14px; margin-top: 12px; }
.btn-wechat:hover { background: #06ad56; }

/* 电脑端：登录页左右分栏 */
@media (min-width: 768px) {
    .login-container { max-width: 780px; padding: 40px; }
    .login-tabs { display: none; }
    .login-divider { display: flex; }
    .login-body .login-tab-content { flex: 1; }
    .login-body .login-tab-content.active { display: block; }
    .login-body .login-tab-content:not(.active) { display: block; }
}

/* 手机端：登录Tab切换 */
@media (max-width: 767px) {
    .login-container { margin: 20px auto; padding: 30px 20px; }
    .login-body { flex-direction: column; }
    .login-tabs { display: flex; }
    .login-divider { display: none; }
    .login-body .login-tab-content:not(.active) { display: none; }
}

.header {
    background: var(--bg-header);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-left { display: flex; align-items: center; gap: 12px; }
.menu-btn { background: none; border: none; font-size: 20px; cursor: pointer; padding: 8px; color: var(--text-primary); }
.header-title { font-size: 18px; font-weight: 600; color: var(--primary); }
.header-right { display: flex; align-items: center; gap: 12px; }
#user-info { font-size: 14px; color: var(--text-secondary); }
#user-info i { margin-right: 4px; }

.sidebar {
    position: fixed;
    left: -280px;
    top: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-card);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: left 0.3s;
    overflow-y: auto;
}
.sidebar.open { left: 0; }
.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-header h3 { font-size: 16px; color: var(--primary); font-weight: 600; }
.sidebar-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); padding: 4px; }
.sidebar-user-info {
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
}
.sidebar-user-info .sidebar-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary-light); color: var(--primary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 14px; flex-shrink: 0; overflow: hidden;
}
.sidebar-user-info .sidebar-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.sidebar-user-info .sidebar-user-name { font-weight: 500; color: var(--text-primary); font-size: 14px; }
.sidebar-user-info .sidebar-user-role { font-size: 11px; }
.menu-list { list-style: none; padding: 0; }
.menu-item {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-light);
    transition: background 0.2s;
}
.menu-item:hover { background: var(--bg-main); }
.menu-item.active { background: var(--primary-light); color: var(--primary); border-left: 3px solid var(--primary); }
.menu-item i { width: 20px; text-align: center; font-size: 16px; }
.menu-item span { font-size: 15px; }
.admin-only { display: none; }
.admin-only.show { display: flex; }

.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}
.overlay.show { opacity: 1; visibility: visible; }

.main-content { padding: 20px; min-height: calc(100vh - 60px); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow);
}
.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
}
.stat-icon.blue { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); }
.stat-icon.green { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.stat-icon.pink { background: linear-gradient(135deg, #ec4899 0%, #be185d 100%); }
.stat-icon.orange { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 13px; color: var(--text-secondary); }

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}
.card h3 { font-size: 16px; color: var(--text-primary); margin-bottom: 16px; }
.card h3 i { margin-right: 8px; color: var(--primary); }
.mt-20 { margin-top: 20px; }

.after17-stats, .marriage-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}
.stat-item, .marriage-item { padding: 10px 14px; background: var(--bg-main); border-radius: var(--radius); font-size: 14px; }
.stat-item b, .marriage-item b { color: var(--primary); margin-left: 4px; }

.recent-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.recent-item {
    padding: 12px;
    background: var(--bg-main);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.recent-item:hover { background: var(--primary-light); }
.recent-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}
.recent-info { flex: 1; }
.recent-name { font-weight: 500; font-size: 14px; }
.recent-meta { font-size: 12px; color: var(--text-muted); }

.section-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.toolbar-actions { display: flex; align-items: center; gap: 10px; }
.search-box {
    flex: 1;
    min-width: 200px;
    max-width: 400px;
    position: relative;
}
.search-box i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.search-box input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
}
.search-box input:focus { outline: none; border-color: var(--primary); }
.filter-select {
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    background: white;
    cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--primary); }

.people-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.person-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}
.person-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.person-card .card-header { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.person-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
}
.person-avatar.female { background: linear-gradient(135deg, #ec4899 0%, #be185d 100%); }
.person-main { flex: 1; }
.person-name { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.person-meta { font-size: 13px; color: var(--text-secondary); }
.person-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}
.badge-alive { background: var(--success-light); color: #065f46; }
.badge-deceased { background: var(--danger-light); color: #991b1b; }
.badge-married { background: #dbeafe; color: #1e40af; }
.badge-unmarried { background: #f3f4f6; color: #6b7280; }

/* 角色标签（5种颜色区分） */
.role-tag { padding: 3px 10px; border-radius: 12px; font-size: 11px; font-weight: 500; display: inline-block; }
.role-tag-guest { background: var(--role-guest-bg); color: var(--role-guest); }
.role-tag-user { background: var(--role-user-bg); color: var(--role-user); }
.role-tag-member { background: var(--role-member-bg); color: var(--role-member); }
.role-tag-admin { background: var(--role-admin-bg); color: var(--role-admin); }
.role-tag-super_admin { background: var(--role-super-admin-bg); color: var(--role-super-admin); }
.role-tag-small { padding: 2px 8px; border-radius: 10px; font-size: 10px; font-weight: 500; }

/* 健在/已逝小圆点 */
.alive-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.alive-dot.alive { background: var(--success); }
.alive-dot.dead { background: var(--text-muted); }
.person-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid var(--border-light); font-size: 12px; color: var(--text-muted); }

.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }
.pagination button { padding: 8px 14px; border: 1px solid var(--border-color); background: white; border-radius: var(--radius); cursor: pointer; }
.pagination button.active { background: var(--primary); color: white; border-color: var(--primary); }
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }

.view-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    flex-wrap: wrap;
    gap: 12px;
}
.zoom-controls { display: flex; align-items: center; gap: 8px; }
.tree-mode-toggle { display: flex; gap: 4px; }
.tree-mode-toggle .btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.tree-hint { font-size: 12px; color: var(--text-muted); }
.baota-filter label { font-size: 14px; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; gap: 6px; }
.baota-filter input { cursor: pointer; }

.tree-layout { display: flex; gap: 20px; height: calc(100vh - 200px); }
.side-panel {
    width: 320px;
    flex-shrink: 0;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    overflow-y: auto;
    position: relative;
}
.side-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }
.side-panel-header h4 { font-size: 16px; color: var(--text-primary); margin: 0; }
.action-buttons { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.tree-container {
    flex: 1;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    position: relative;
}
.tree-canvas, .baota-canvas {
    width: 100%;
    height: 100%;
    overflow: auto;
    position: relative;
}
.tree-node {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    user-select: none;
}
.tree-node-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 10px 14px;
    min-width: 80px;
    text-align: center;
    transition: all 0.2s;
    box-shadow: var(--shadow);
}
.tree-node-card:hover { border-color: var(--primary); transform: scale(1.05); }
.tree-node-card.selected { border-color: var(--primary); background: var(--primary-light); }
.tree-node-card.has-children { border-color: var(--success); }
.tree-node-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 600;
    margin: 0 auto 6px;
}
.tree-node-avatar.female { background: linear-gradient(135deg, #ec4899 0%, #be185d 100%); }
.tree-node-name { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; }
.tree-node-meta { font-size: 11px; color: var(--text-muted); }
.tree-children { display: flex; gap: 20px; margin-top: 20px; }
.tree-child { display: flex; flex-direction: column; align-items: center; }
.tree-lines { position: absolute; pointer-events: none; }

.side-panel {
    width: 300px;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s;
}
.side-panel.hidden { width: 0; padding: 0; overflow: hidden; opacity: 0; }
.side-panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--border-color); }
.side-panel-header h4 { font-size: 15px; color: var(--text-primary); }
.side-panel-header h4 i { margin-right: 6px; color: var(--primary); }
.selected-info { flex: 1; overflow-y: auto; margin-bottom: 16px; }
.info-row { display: flex; padding: 8px 0; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.info-label { width: 80px; color: var(--text-muted); }
.info-value { flex: 1; color: var(--text-primary); }
.action-buttons { display: flex; flex-direction: column; gap: 8px; }

.gen-nav { display: flex; align-items: center; gap: 10px; }
.gen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.gen-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}
.gen-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.gen-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.gen-card-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.gen-card-count { background: var(--primary); color: white; padding: 4px 10px; border-radius: 12px; font-size: 12px; }
.gen-card-list { font-size: 13px; color: var(--text-secondary); }

.gender-ratio { padding: 10px 0; }
.ratio-bar { height: 24px; border-radius: 12px; overflow: hidden; display: flex; background: #f3f4f6; }
.ratio-male { background: linear-gradient(90deg, var(--primary) 0%, #60a5fa 100%); height: 100%; transition: width 0.3s; }
.ratio-female { background: linear-gradient(90deg, #ec4899 0%, #f472b6 100%); height: 100%; transition: width 0.3s; }
.ratio-labels { display: flex; justify-content: space-between; margin-top: 10px; font-size: 14px; color: var(--text-secondary); }
.ratio-labels i { margin-right: 4px; }

.users-list { display: flex; flex-direction: column; gap: 12px; }
.user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    background: var(--bg-main);
    border-radius: var(--radius);
}
.user-info { display: flex; align-items: center; gap: 12px; }
.user-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.user-details h4 { font-size: 15px; color: var(--text-primary); margin-bottom: 4px; }
.user-details p { font-size: 13px; color: var(--text-muted); }
.user-role { padding: 4px 10px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.role-super { background: var(--role-super-admin-bg); color: var(--role-super-admin); }
.role-admin { background: var(--role-admin-bg); color: var(--role-admin); }
.role-member { background: var(--role-member-bg); color: var(--role-member); }
.role-user { background: var(--role-user-bg); color: var(--role-user); }
.role-guest { background: var(--role-guest-bg); color: var(--role-guest); }
.user-actions { display: flex; gap: 8px; }

.import-area { text-align: center; padding: 30px 0; }
.import-actions { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; }
.import-hint { margin-top: 16px; color: var(--text-muted); font-size: 13px; }

.backup-actions { display: flex; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.backup-list { display: flex; flex-direction: column; gap: 10px; }
.backup-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--bg-main); border-radius: var(--radius); font-size: 13px; }
.backup-item i { margin-right: 8px; color: var(--primary); }
.backup-time { color: var(--text-muted); }

.photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.photo-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.2s;
}
.photo-card:hover { transform: scale(1.02); box-shadow: var(--shadow-lg); }
.photo-thumb { width: 100%; height: 150px; object-fit: cover; background: var(--bg-main); display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.photo-info { padding: 10px; font-size: 13px; color: var(--text-secondary); }

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 2001;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}
.modal.show { opacity: 1; visibility: visible; }
.modal-content { padding: 0; }
.modal-content.modal-large { max-width: 700px; }
.modal-content.modal-small { max-width: 400px; }
.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-header h3 { font-size: 18px; color: var(--text-primary); }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--text-muted); padding: 0; line-height: 1; }
.modal-close:hover { color: var(--text-primary); }
.modal-body { padding: 20px; }
.modal-footer { padding: 16px 20px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 10px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 500; color: var(--text-primary); }
.form-group label .required { color: var(--danger); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    transition: border-color 0.2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.checkbox-group label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: normal; }
.checkbox-group input { width: auto; }

.tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid var(--border-color); }
.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    font-size: 14px;
    cursor: pointer;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-size: 14px;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.3s;
}
.toast.show { opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.9);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.loading-spinner { text-align: center; }
.loading-spinner i { font-size: 40px; color: var(--primary); margin-bottom: 10px; }
.loading-spinner span { display: block; font-size: 14px; color: var(--text-secondary); }

.detail-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 600;
    margin: 0 auto 16px;
}
.detail-avatar.female { background: linear-gradient(135deg, #ec4899 0%, #be185d 100%); }
.detail-header { text-align: center; margin-bottom: 20px; }
.detail-header h2 { font-size: 22px; color: var(--text-primary); margin-bottom: 8px; }
.detail-header p { color: var(--text-secondary); font-size: 14px; }
.detail-badges { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.detail-section { margin-bottom: 20px; }
.detail-section h4 { font-size: 14px; color: var(--text-muted); margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); }
.detail-section h4 i { margin-right: 6px; color: var(--primary); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-item { font-size: 14px; }
.detail-item-label { color: var(--text-muted); font-size: 13px; margin-bottom: 2px; }
.detail-item-value { color: var(--text-primary); }

.tree-node-line {
    position: absolute;
    pointer-events: none;
}
.tree-node-line.h-line {
    height: 2px;
    background: var(--border-color);
}
.tree-node-line.v-line {
    width: 2px;
    background: var(--border-color);
}

@media (max-width: 767px) {
    .header-title { font-size: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .tree-layout { flex-direction: column; height: auto; }
    .side-panel { width: 100%; }
    .form-row { grid-template-columns: 1fr; }
    .people-list { grid-template-columns: 1fr; }
    .gen-grid { grid-template-columns: 1fr; }
    .login-container { margin: 20px auto; padding: 30px 20px; }
    .detail-grid { grid-template-columns: 1fr; }

    /* 手机端：隐藏电脑侧边栏，显示底部Tab */
    .desktop-sidebar { display: none; }
    .desktop-main { margin-left: 0; max-width: 100vw; }
    .bottom-tab-bar { display: block; }

    /* 手机端：内容区留出底部Tab空间 */
    .main-content, .desktop-main { padding-bottom: calc(var(--tab-bar-height) + 16px); }

    /* 手机端：Modal改为底部弹出Sheet */
    .modal {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        width: 100%;
        max-width: 100%;
        max-height: 85vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        animation: slideUp 0.3s ease;
    }
    .modal.show { transform: none; }
    .modal-overlay { align-items: flex-end; }

    /* 手机端：世系图/宝塔树侧面板改为底部弹出 */
    .tree-layout .side-panel {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        max-height: 60vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        box-shadow: 0 -4px 16px rgba(0,0,0,0.15);
        z-index: 200;
        overflow-y: auto;
        animation: slideUp 0.3s ease;
    }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ═══ 电脑端（≥768px） ═══ */
@media (min-width: 768px) {
    .bottom-tab-bar { display: none; }
    .mobile-only { display: none !important; }
    /* 电脑端：侧边栏固定显示 */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: var(--sidebar-width);
        height: 100vh;
        background: var(--bg-card);
        border-right: 1px solid var(--border-color);
        box-shadow: none;
        z-index: 100;
        overflow-y: auto;
        display: block;
        transition: none;
    }
    .sidebar-header { border-bottom: 1px solid var(--border-color); }
    .overlay { display: none; }
    .main-content { margin-left: var(--sidebar-width); padding: 20px; }
    .header { display: none; }
    /* 电脑端：Modal居中弹窗 */
    .modal {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
    }
}

/* ═══ 手机端（<768px） ═══ */
@media (max-width: 767px) {
    .desktop-only { display: none !important; }
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 280px;
        height: 100vh;
        background: var(--bg-card);
        box-shadow: var(--shadow-lg);
        z-index: 1000;
        transition: left 0.3s;
        overflow-y: auto;
        display: block;
    }
    .sidebar.open { left: 0; }
    .overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.5);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
    }
    .overlay.show { opacity: 1; visibility: visible; }
    .main-content { margin-left: 0; padding-bottom: calc(var(--tab-bar-height) + 16px); }
    .header { display: flex; }
}

/* ═══ 大屏（≥1200px） ═══ */
@media (min-width: 1200px) {
    .main-content { max-width: var(--content-max-width); margin-left: var(--sidebar-width); }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    .gen-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
    .people-list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

/* ═══════════════════════════════════════════════
   人员编辑页样式 (Person Edit)
   ═══════════════════════════════════════════════ */

/* 顶部返回栏 */
.pe-back-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px 16px; background: #fff;
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10;
}
.pe-back-bar .pe-title {
    font-size: 17px; font-weight: 600; color: var(--text-primary);
}

/* 滚动内容区 */
.pe-scroll-content {
    padding: 12px 16px 80px;
}

/* 通用卡片 */
.pe-card {
    background: #fff; border-radius: 12px;
    padding: 16px 18px; margin-bottom: 12px;
    box-shadow: var(--shadow);
}

.pe-section-header {
    font-size: 14px; font-weight: 600; color: #495057;
    margin-bottom: 10px; padding-bottom: 8px;
    border-bottom: 1px solid #e9ecef;
}

/* 配偶模式提示条 */
.pe-spouse-hint {
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 100%);
    border-radius: 12px; padding: 14px 18px; margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
    box-shadow: 0 2px 8px rgba(233,30,99,0.12);
}
.pe-hint-icon { font-size: 20px; flex-shrink: 0; }
.pe-hint-text { font-size: 13px; color: #c2185b; font-weight: 500; line-height: 1.5; }

/* 头像+姓名区 */
.pe-avatar-name-row { display: flex; gap: 10px; }
.pe-avatar-box {
    width: 110px; height: 110px; flex-shrink: 0;
    background: #e0e0e0; border-radius: 10px; overflow: hidden;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; position: relative;
}
.pe-avatar-box:hover { opacity: 0.85; }
.pe-avatar-img { width: 100%; height: 100%; object-fit: cover; }
.pe-avatar-placeholder {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 2px;
}
.pe-avatar-icon { font-size: 28px; color: #999; font-weight: bold; }
.pe-avatar-text { font-size: 11px; color: #999; }

.pe-name-fields {
    flex: 1; display: flex; flex-direction: column;
    justify-content: space-between; min-height: 110px;
}
.pe-name-row {
    display: flex; align-items: center; height: 34px;
    border-bottom: 1px solid #f0f0f0;
}
.pe-field-label {
    font-size: 14px; color: #333; width: 52px;
    flex-shrink: 0; text-align: right; padding-right: 6px;
}

/* 输入框容器 */
.pe-input-wrap {
    flex: 1; min-width: 0; background: #f8f9fa;
    border: 1px solid #d0d5dd; border-radius: 6px;
    padding: 0 8px; overflow: hidden;
}
.pe-input {
    width: 100%; height: 32px; line-height: 32px;
    font-size: 14px; color: #333; border: none;
    background: transparent; outline: none;
}
.pe-name-input-wrap { max-width: 140px; }
.pe-gen-input-wrap { max-width: 60px; }

/* 性别选择 */
.pe-gender-box {
    flex-shrink: 0; margin-left: 6px;
    font-size: 13px; color: #667eea; background: #f0f4ff;
    padding: 4px 14px; border-radius: 6px; font-weight: 500;
    text-align: center; cursor: pointer; user-select: none;
}
.pe-gender-box:hover { background: #e0e7ff; }

/* 世系选择 */
.pe-shixi-label {
    font-size: 13px; color: #667eea; margin-left: 4px;
    flex-shrink: 0; padding-right: 2px;
}
.pe-shixi-select {
    font-size: 13px; color: #764ba2; background: #f3e8ff;
    padding: 4px 8px; border-radius: 6px; font-weight: 500;
    border: none; cursor: pointer; max-width: 64px;
}

/* 手机号行 */
.pe-phone-row {
    display: flex; align-items: center; height: 34px;
    border-top: 1px solid #f0f0f0; margin-top: 6px; padding-top: 6px;
}

/* 排行+父亲+过继三列 */
.pe-triple-row {
    display: flex; padding: 14px 10px; gap: 8px;
}
.pe-triple-item {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; gap: 6px;
}
.pe-triple-label { font-size: 13px; color: #666; font-weight: 500; }
.pe-triple-picker {
    font-size: 13px; color: #333; background: #f8f9fa;
    padding: 8px 4px; border-radius: 6px;
    border: 1px solid #e0e0e0; text-align: center;
    width: 100%; box-sizing: border-box; cursor: pointer;
}

/* 开关组件 */
.pe-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.pe-switch input { opacity: 0; width: 0; height: 0; }
.pe-switch-slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background: #ccc; border-radius: 24px; transition: 0.3s;
}
.pe-switch-slider:before {
    position: absolute; content: ""; height: 18px; width: 18px;
    left: 3px; bottom: 3px; background: #fff;
    border-radius: 50%; transition: 0.3s;
}
.pe-switch input:checked + .pe-switch-slider { background: #667eea; }
.pe-switch input:checked + .pe-switch-slider:before { transform: translateX(20px); }
.pe-switch input:disabled + .pe-switch-slider { opacity: 0.5; cursor: not-allowed; }

/* 继父列表 */
.pe-adopt-section { padding: 12px 14px; }
.pe-adopt-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.pe-adopt-label { font-size: 13px; color: #666; flex-shrink: 0; min-width: 48px; }
.pe-adopt-picker {
    flex: 1; min-width: 0; font-size: 12px; color: #007bff;
    background: #e7f1ff; padding: 6px 8px; border-radius: 6px;
    border: none; cursor: pointer; box-sizing: border-box;
}
.pe-adopt-remove {
    width: 24px; height: 24px; display: flex; align-items: center;
    justify-content: center; color: #e74c3c; font-size: 14px;
    flex-shrink: 0; cursor: pointer;
}
.pe-adopt-remove:hover { opacity: 0.6; }
.pe-adopt-add {
    display: flex; align-items: center; justify-content: center;
    padding: 8px; color: #007bff; font-size: 13px;
    background: #f0f7ff; border-radius: 6px;
    border: 1px dashed #007bff; cursor: pointer;
}
.pe-adopt-add:hover { background: #e0efff; }

/* 健在+历法行 */
.pe-status-row { display: flex; align-items: center; padding: 14px 18px; }
.pe-alive-toggle { display: flex; align-items: center; gap: 8px; }
.pe-alive-label { font-size: 14px; font-weight: 600; color: #333; }
.pe-alive-status { font-size: 12px; color: #6c757d; }
.pe-calendar-select { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.pe-calendar-label { font-size: 13px; color: #666; }
.pe-calendar-box {
    font-size: 13px; color: #fff;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 5px 16px; border-radius: 6px; text-align: center;
    border: none; cursor: pointer;
}

/* 出生/去世信息 */
.pe-birth-section, .pe-death-section { padding: 14px 18px; }
.pe-date-row { display: flex; align-items: center; gap: 6px; }
.pe-date-input {
    flex: 1; font-size: 14px; color: #333;
    padding: 8px 10px; background: #f8f9fa;
    border-radius: 6px; border: 1px solid #e0e0e0;
}
.pe-unknown-btn {
    flex-shrink: 0; font-size: 12px; color: #999;
    padding: 6px 14px; background: #fff;
    border: 1px solid #ddd; border-radius: 20px;
    cursor: pointer; white-space: nowrap;
}
.pe-unknown-btn:hover { border-color: #e74c3c; color: #e74c3c; }
.pe-unknown-active { color: #e74c3c !important; border-color: #e74c3c !important; background: #fef0ef !important; font-weight: 600; }
.pe-death-age { font-size: 14px; font-weight: 600; color: #e74c3c; margin-top: 8px; padding: 4px 10px; background: #fef0ef; border-radius: 6px; }

/* 其他图片 */
.pe-other-image-section { padding: 14px; }
.pe-other-image-box { display: flex; flex-wrap: wrap; gap: 10px; }
.pe-other-thumb-wrap {
    position: relative; width: 100px; height: 100px;
    border-radius: 8px; overflow: hidden; border: 1px solid #e0e0e0;
}
.pe-other-thumb { width: 100%; height: 100%; object-fit: cover; }
.pe-thumb-remove {
    position: absolute; top: -4px; right: -4px;
    width: 20px; height: 20px; line-height: 20px;
    background: rgba(231,76,60,0.9); color: #fff;
    border-radius: 50%; text-align: center; font-size: 12px;
    cursor: pointer;
}
.pe-other-add {
    width: 100px; height: 100px; border: 2px dashed #ccc;
    border-radius: 8px; display: flex; align-items: center;
    justify-content: center; background: #fafafa; cursor: pointer;
}
.pe-other-add:hover { border-color: #667eea; }
.pe-other-add-icon { font-size: 32px; color: #bbb; font-weight: bold; }

/* 籍贯/排序/居住地 */
.pe-info-grid { padding: 14px 18px; }
.pe-info-row {
    display: flex; align-items: center; padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}
.pe-info-row:last-child { border-bottom: none; }

/* 文本区 */
.pe-textarea {
    width: 100%; min-height: 100px; font-size: 14px; color: #333;
    background: #f8f9fa; border-radius: 8px; padding: 10px;
    box-sizing: border-box; border: 1px solid #e9ecef; resize: vertical;
    outline: none; font-family: inherit;
}
.pe-textarea:focus { border-color: #667eea; }
.pe-textarea-sm { min-height: 40px; height: 40px; }

/* 底部区域 */
.pe-bottom-area { padding: 12px 0; }

/* 配偶开关行 */
.pe-spouse-toggle-row {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 16px; padding: 14px 16px;
    background: linear-gradient(135deg, #fce4ec 0%, #f8bbd0 100%);
    border-radius: 12px;
}
.pe-spouse-toggle-label { font-size: 15px; font-weight: bold; color: #c2185b; flex: 1; }
.pe-label-disabled { color: #bbb; }
.pe-spouse-toggle-status { font-size: 12px; color: #ad1457; }

/* 提交按钮 */
.pe-submit-btn {
    width: 100%; height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff; border: none; border-radius: 24px;
    font-size: 16px; font-weight: 600;
    box-shadow: 0 4px 16px rgba(102,126,234,0.3);
    cursor: pointer;
}
.pe-submit-btn:hover { opacity: 0.9; }
.pe-submit-btn:disabled { opacity: 0.7; cursor: not-allowed; }

/* 配偶面板 */
.pe-spouse-panel { margin-top: 12px; }
.pe-spouse-divider {
    text-align: center; font-size: 13px; color: #e91e63;
    padding: 10px 0 6px; font-weight: 500;
}
.pe-spouse-card { border: 1px solid #f8bbd0; }
.pe-spouse-card .pe-section-header { color: #c2185b; border-bottom-color: #f8bbd0; }

/* ═══ 人员编辑响应式 ═══ */
@media (min-width: 768px) {
    .pe-scroll-content { max-width: 720px; margin: 0 auto; padding: 16px 20px 80px; }
    .pe-avatar-box { width: 140px; height: 140px; }
    .pe-name-fields { min-height: 140px; }
    .pe-name-input-wrap { max-width: 180px; }
    .pe-gen-input-wrap { max-width: 80px; }
    .pe-other-thumb-wrap { width: 130px; height: 130px; }
    .pe-other-add { width: 130px; height: 130px; }
}

/* ═══════════════════════════════════════════════════════════════
   祭拜神台 — 古风样式 + CSS烟雾动画 + 香燃烧动画
   ═══════════════════════════════════════════════════════════════ */
.altar-page {
    display: flex; flex-direction: column; align-items: center;
    padding: 16px; min-height: 80vh;
    background: linear-gradient(180deg, #1a0a00 0%, #2d1810 30%, #1a0a00 100%);
    color: #f5e6d3; position: relative; overflow: hidden;
}
.altar-back { align-self: flex-start; margin-bottom: 12px; }
.altar-back .btn { color: #f5e6d3; border-color: #f5e6d3; }

/* 匾额 */
.altar-plaque {
    font-size: 28px; font-weight: bold; letter-spacing: 12px;
    color: #ffd700; text-shadow: 0 0 20px rgba(255,215,0,0.6), 0 2px 4px rgba(0,0,0,0.8);
    padding: 12px 32px; margin-bottom: 20px;
    border: 2px solid #8b6914; border-radius: 4px;
    background: linear-gradient(180deg, #5c3a0e 0%, #3d2408 100%);
    position: relative;
}
.altar-plaque::before, .altar-plaque::after {
    content: ''; position: absolute; top: 50%; width: 20px; height: 20px;
    border: 2px solid #8b6914; border-radius: 50%;
    transform: translateY(-50%); background: #3d2408;
}
.altar-plaque::before { left: -30px; }
.altar-plaque::after { right: -30px; }

/* 牌位 */
.altar-tablet {
    text-align: center; padding: 24px 40px; margin-bottom: 24px;
    background: linear-gradient(180deg, #4a2c0a 0%, #2d1806 100%);
    border: 2px solid #8b6914; border-radius: 8px;
    box-shadow: 0 0 30px rgba(255,215,0,0.15);
}
.altar-shi-xi { font-size: 14px; color: #c9a96e; margin-bottom: 4px; }
.altar-name { font-size: 32px; font-weight: bold; color: #ffd700; text-shadow: 0 0 10px rgba(255,215,0,0.4); margin-bottom: 4px; }
.altar-title { font-size: 16px; color: #c9a96e; }

/* 香炉 */
.altar-censer {
    position: relative; width: 120px; height: 80px; margin-bottom: 20px;
}
.altar-censer::before {
    content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
    width: 100px; height: 60px;
    background: linear-gradient(180deg, #8b6914 0%, #5c3a0e 100%);
    border-radius: 0 0 50% 50%; border: 2px solid #a07828;
    border-top: none;
}
.altar-censer::after {
    content: ''; position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    width: 110px; height: 20px;
    background: linear-gradient(180deg, #8b6914 0%, #5c3a0e 100%);
    border-radius: 50%; border: 2px solid #a07828;
}

/* 烟雾层 */
.altar-smoke-layer {
    position: absolute; top: -60px; left: 50%; width: 4px; height: 60px;
    transform-origin: bottom center; opacity: 0;
    background: linear-gradient(180deg, transparent 0%, rgba(200,200,200,0.3) 100%);
    border-radius: 50%;
}
.altar-smoke-layer.burning { opacity: 1; animation: smokeRise 3s ease-out infinite; }
.smoke-1 { left: 45%; animation-delay: 0s; }
.smoke-2 { left: 50%; animation-delay: 0.8s; width: 3px; }
.smoke-3 { left: 55%; animation-delay: 1.6s; width: 5px; }

@keyframes smokeRise {
    0% { opacity: 0.6; transform: translateX(-50%) translateY(0) scaleX(1); height: 60px; }
    50% { opacity: 0.3; transform: translateX(-50%) translateY(-40px) scaleX(2); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-80px) scaleX(3); }
}

/* 香容器 */
.altar-incense-container {
    position: absolute; top: -20px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 6px; justify-content: center;
}

/* 单支香 */
.altar-incense-stick {
    width: 3px; height: 40px; background: linear-gradient(180deg, #d4a44a 0%, #8b6914 100%);
    border-radius: 1px; position: relative;
}
.altar-incense-stick::before {
    content: ''; position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
    width: 5px; height: 5px; border-radius: 50%;
    background: #ff6600; box-shadow: 0 0 8px #ff6600, 0 0 16px rgba(255,102,0,0.5);
    animation: incenseGlow 1.5s ease-in-out infinite alternate;
}
.altar-incense-stick.burning {
    animation: incenseBurn 60s linear forwards;
}

@keyframes incenseGlow {
    0% { box-shadow: 0 0 6px #ff6600, 0 0 12px rgba(255,102,0,0.3); }
    100% { box-shadow: 0 0 10px #ff6600, 0 0 20px rgba(255,102,0,0.6); }
}

@keyframes incenseBurn {
    0% { height: 40px; }
    100% { height: 4px; }
}

/* 火花效果（三支香中间那支） */
.altar-incense-stick.spark::after {
    content: ''; position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
    width: 2px; height: 2px; background: #fff;
    animation: sparkAnim 0.8s ease-out infinite;
}

@keyframes sparkAnim {
    0% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(0); }
}

/* 烛台 */
.altar-candles {
    display: flex; gap: 80px; margin-bottom: 16px; justify-content: center;
}
.altar-candle {
    width: 12px; height: 50px;
    background: linear-gradient(180deg, #ff4444 0%, #cc0000 60%, #8b0000 100%);
    border-radius: 2px 2px 0 0; position: relative;
}
.candle-flame {
    position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
    width: 8px; height: 14px;
    background: radial-gradient(ellipse at center, #fff 0%, #ffcc00 40%, #ff6600 100%);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flameFlicker 0.3s ease-in-out infinite alternate;
    box-shadow: 0 0 10px rgba(255,165,0,0.6), 0 0 20px rgba(255,100,0,0.3);
}

@keyframes flameFlicker {
    0% { transform: translateX(-50%) scaleY(1) rotate(-2deg); }
    100% { transform: translateX(-50%) scaleY(1.1) rotate(2deg); }
}

/* 供品台 */
.altar-offerings {
    font-size: 28px; margin-bottom: 20px;
    padding: 12px 32px;
    background: rgba(139,105,20,0.2); border-radius: 8px;
    border: 1px solid rgba(139,105,20,0.4);
}

/* 进度文字 */
.altar-progress {
    font-size: 14px; color: #c9a96e; margin-bottom: 16px; min-height: 20px; text-align: center;
}

/* 上香按钮 */
.btn-worship {
    background: linear-gradient(135deg, #8b6914 0%, #5c3a0e 100%);
    color: #ffd700; border: 1px solid #a07828; border-radius: 24px;
    padding: 12px 24px; font-size: 16px; cursor: pointer;
    box-shadow: 0 2px 10px rgba(139,105,20,0.4);
    transition: all 0.3s;
}
.btn-worship:hover { background: linear-gradient(135deg, #a07828 0%, #6d450f 100%); }
.btn-worship:disabled { opacity: 0.5; cursor: not-allowed; }

.altar-buttons { display: flex; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; justify-content: center; }

.altar-merit-info { font-size: 13px; color: #c9a96e; text-align: center; }

/* ═══ 各世统计筛选栏 ═══ */
.gen-stats-controls {
    display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap;
}
.gen-stats-controls .filter-toggle-btn { font-size: 13px; padding: 6px 12px; }

/* ═══ 字辈列表增强 ═══ */
.gen-name-actions { display: flex; gap: 6px; margin-left: auto; }
.gen-name-ununified { color: var(--warning); }

/* ═══ 留言内联回复框 ═══ */
.msg-reply-box {
    margin-top: 8px; padding: 12px;
    background: var(--primary-light, #e0e7ff); border-radius: 8px;
}
.msg-reply-input {
    width: 100%; padding: 8px 12px; border: 1px solid var(--border, #e2e8f0);
    border-radius: 6px; font-size: 14px; resize: none;
    box-sizing: border-box;
}
.msg-reply-actions { display: flex; gap: 8px; margin-top: 8px; justify-content: flex-end; }

/* ═══ 公告变量插入栏 ═══ */
.ann-tpl-bar {
    display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px;
}
.ann-tpl-bar .btn { font-size: 11px; padding: 2px 8px; }

/* ═══ 公告板底部导航 ═══ */
.board-bottom-nav {
    display: flex; gap: 8px; margin-top: 20px; padding-top: 16px;
    border-top: 1px solid var(--border, #e2e8f0);
}

/* ═══════════════════════════════════════════════════════════════
   世系图 — 层级列表样式
   ═══════════════════════════════════════════════════════════════ */
.tree-node { border-bottom: 1px solid rgba(0,0,0,0.04); }
.tree-node-content {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; cursor: pointer; transition: background 0.2s;
}
.tree-node-content:hover { background: rgba(102,126,234,0.06); }
.tree-node-highlight .tree-node-content { background: rgba(255,193,7,0.12); border-left: 3px solid var(--warning, #ed8936); }
.tree-toggle {
    width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-muted, #a0aec0); font-size: 12px; flex-shrink: 0;
}
.tree-toggle i { transition: transform 0.2s; }
.tree-toggle-placeholder { width: 20px; flex-shrink: 0; }
.tree-node-avatar { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; }
.tree-node-info { flex: 1; min-width: 0; }
.tree-node-name { font-size: 14px; font-weight: 500; color: var(--text-primary, #2d3748); }
.tree-node-meta { font-size: 11px; color: var(--text-secondary, #718096); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tree-children { border-left: 2px solid rgba(102,126,234,0.15); margin-left: 22px; }
.tree-children.hidden { display: none; }

/* 纯脉展示提示条 */
.tree-pure-lineage-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 16px; margin-bottom: 12px;
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    border-radius: 8px; font-size: 14px; color: #4338ca;
}

/* 搜索下拉 */
.tree-search-dropdown {
    position: absolute; top: 100%; left: 0; right: 0;
    background: #fff; border: 1px solid var(--border, #e2e8f0);
    border-radius: 0 0 8px 8px; box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 100; max-height: 300px; overflow-y: auto;
}
.tree-search-item {
    display: flex; align-items: center; gap: 8px;
    padding: 8px 12px; cursor: pointer; border-bottom: 1px solid #f0f0f0;
}
.tree-search-item:hover { background: #f7f7f7; }
.tree-search-avatar { width: 24px; height: 24px; border-radius: 50%; }

/* 侧边面板人员详情 */
.side-person-avatar { display: flex; justify-content: center; margin-bottom: 8px; }
.side-person-name { font-size: 18px; font-weight: bold; text-align: center; margin-bottom: 4px; }
.side-person-meta { font-size: 13px; color: var(--text-secondary, #718096); text-align: center; margin-bottom: 4px; }
.side-person-status { font-size: 13px; text-align: center; margin-bottom: 8px; }
.side-person-spouse { font-size: 13px; color: var(--text-secondary, #718096); margin-bottom: 4px; }
.side-person-children { font-size: 13px; color: var(--text-secondary, #718096); margin-bottom: 12px; }
.side-person-hint { font-size: 12px; margin-bottom: 8px; }
.side-person-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* ═══════════════════════════════════════════════════════════════
   宝塔树 — 世代分行布局
   ═══════════════════════════════════════════════════════════════ */
.baota-gen-row {
    margin-bottom: 16px; padding: 0 12px;
}
.baota-gen-label {
    font-size: 13px; font-weight: 600; color: var(--primary, #667eea);
    margin-bottom: 8px; padding-left: 4px;
    border-left: 3px solid var(--primary, #667eea); padding-left: 8px;
}
.baota-gen-nodes {
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: center;
}
.baota-node {
    display: flex; flex-direction: column; align-items: center;
    padding: 8px; border: 1px solid var(--border, #e2e8f0);
    border-radius: 8px; cursor: pointer; position: relative;
    min-width: 64px; max-width: 90px; transition: all 0.2s;
    background: #fff;
}
.baota-node:hover { border-color: var(--primary, #667eea); box-shadow: 0 2px 8px rgba(102,126,234,0.15); transform: translateY(-1px); }
.baota-node-highlight { border-color: var(--warning, #ed8936); background: rgba(255,193,7,0.08); }
.baota-node-avatar { width: 32px; height: 32px; border-radius: 50%; margin-bottom: 4px; }
.baota-node-name { font-size: 12px; font-weight: 500; text-align: center; word-break: break-all; line-height: 1.3; }
.baota-node-gen { font-size: 10px; color: var(--text-muted, #a0aec0); }
.baota-node-spouse { font-size: 9px; color: var(--text-secondary, #718096); text-align: center; }

/* 继子标识 */
.adopt-tag {
    display: inline-block; font-size: 10px; color: #9333ea; background: #f3e8ff;
    border-radius: 3px; padding: 0 3px; font-weight: normal; vertical-align: middle; margin-left: 2px;
}
.tree-node-adopted .tree-node-content { border-left: 3px solid #9333ea; }
.baota-node-adopted { border-color: #9333ea !important; background: #faf5ff !important; }

/* 世系图/宝塔树 公告栏 */
#tree-announcement-bar, #baota-announcement-bar {
    display: none;
}
#tree-announcement-bar:not(.hidden), #baota-announcement-bar:not(.hidden) {
    display: flex;
}

/* ★ 配偶模式：亲属关系提示条 */
.pe-relation-hint {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 12px;
    padding: 14px 20px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 3px 10px rgba(255, 152, 0, 0.12);
}
.pe-relation-hint-icon { font-size: 20px; flex-shrink: 0; }
.pe-relation-hint-text { font-size: 15px; color: #e65100; font-weight: 600; }