/* ========== 全局重置 ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #2b7cff;
    --primary-hover: #1a66e6;
    --primary-light: #e8f1ff;
    --danger: #e74c3c;
    --danger-hover: #c0392b;
    --success: #27ae60;
    --sidebar-bg: #2b2f3a;
    --sidebar-hover: #363b48;
    --sidebar-active: #2b7cff;
    --topbar-bg: #fff;
    --topbar-border: #e8e8e8;
    --content-bg: #f5f7fa;
    --card-bg: #fff;
    --text-primary: #333;
    --text-secondary: #666;
    --text-muted: #999;
    --border-color: #e8e8e8;
    --radius: 6px;
    --shadow: 0 1px 4px rgba(0,0,0,.06);
    --sidebar-width: 210px;
    --topbar-height: 52px;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", -apple-system, "Helvetica Neue", sans-serif;
    background: var(--content-bg);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========== 登录页（全屏左右分栏） ========== */
.login-page {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* 左侧品牌区 */
.login-brand {
    flex: 1.2;
    background: linear-gradient(135deg, #1a2332 0%, #2b3a55 50%, #1e3a5f 100%);
    color: #fff;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.brand-inner {
    position: relative;
    z-index: 2;
    padding: 40px;
    max-width: 480px;
    width: 100%;
}
.brand-logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}
.brand-icon {
    width: 52px; height: 52px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 700;
    box-shadow: 0 4px 16px rgba(43,124,255,.4);
}
.brand-logo h1 { font-size: 24px; font-weight: 700; letter-spacing: 1px; }
.brand-slogan {
    font-size: 18px;
    color: rgba(255,255,255,.85);
    margin-bottom: 36px;
    letter-spacing: 2px;
}
.brand-features {
    list-style: none;
    margin-bottom: 48px;
}
.brand-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    font-size: 15px;
    color: rgba(255,255,255,.8);
}
.brand-features .dot {
    width: 8px; height: 8px;
    background: var(--primary);
    border-radius: 50%;
    flex-shrink: 0;
}
.brand-footer {
    font-size: 13px;
    color: rgba(255,255,255,.4);
}
/* 装饰圆 */
.brand-decor {
    position: absolute;
    border-radius: 50%;
    background: rgba(43,124,255,.12);
    z-index: 1;
}
.decor-1 { width: 400px; height: 400px; top: -120px; right: -100px; }
.decor-2 { width: 300px; height: 300px; bottom: -80px; left: -60px; background: rgba(43,124,255,.08); }

/* 右侧登录表单区 */
.login-form-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 40px 20px;
}
.login-form-card {
    width: 100%;
    max-width: 380px;
}
.login-form-card h2 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.login-subtitle {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
}
.login-form .form-group { margin-bottom: 20px; }
.login-form label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}
.input-icon {
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: #fafbfc;
    transition: all .2s;
    overflow: hidden;
}
.input-icon:focus-within {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(43,124,255,.1);
}
.input-prefix {
    padding: 0 14px;
    font-size: 16px;
    opacity: .5;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 46px;
    height: 44px;
    border-right: 1px solid var(--border-color);
    background: #f5f6f8;
}
.input-icon input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    min-width: 0;
}
.input-icon input::placeholder {
    color: #bbb;
}
.btn-lg { padding: 12px 18px; font-size: 15px; }
.login-tip {
    margin-top: 24px;
    padding: 12px 14px;
    background: #f8f9fb;
    border-radius: var(--radius);
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
}
.tip-icon { flex-shrink: 0; font-size: 14px; }

/* ========== 侧边栏（宝塔风格） ========== */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    color: #c0c4cc;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform .25s ease;
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px;
    height: var(--topbar-height);
    border-bottom: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}
.logo-icon {
    width: 32px; height: 32px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.logo-text {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 0;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 2px; }

.nav-group { margin-bottom: 8px; }
.nav-group-title {
    padding: 8px 20px 6px;
    font-size: 11px;
    color: rgba(255,255,255,.35);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: #c0c4cc;
    text-decoration: none;
    font-size: 14px;
    transition: all .15s;
    border-left: 3px solid transparent;
}
.nav-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
    text-decoration: none;
}
.nav-item.active {
    background: rgba(43,124,255,.15);
    color: #fff;
    border-left-color: var(--primary);
}
.nav-icon {
    width: 18px;
    text-align: center;
    font-size: 15px;
    flex-shrink: 0;
}

.sidebar-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,.06);
    flex-shrink: 0;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.user-avatar {
    width: 34px; height: 34px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}
.user-detail { min-width: 0; }
.user-name {
    font-size: 13px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role { font-size: 11px; color: rgba(255,255,255,.4); }
.logout-btn {
    width: 32px; height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,.5);
    border-radius: 6px;
    font-size: 16px;
    flex-shrink: 0;
    transition: all .15s;
}
.logout-btn:hover {
    background: rgba(231,76,60,.2);
    color: #e74c3c;
    text-decoration: none;
}

/* 侧边栏遮罩 */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,.4);
    z-index: 999;
}
.sidebar-overlay.show { display: block; }

/* ========== 主区域 ========== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 顶部栏 */
.topbar {
    height: var(--topbar-height);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 16px;
}
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 36px; height: 36px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
}
.menu-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text-secondary);
    border-radius: 1px;
}
.menu-toggle:hover { background: #f0f0f0; }
.topbar-breadcrumb {
    flex: 1;
    font-size: 14px;
    color: var(--text-secondary);
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 14px;
}
.topbar-username {
    font-size: 14px;
    color: var(--text-secondary);
}
.topbar-logout {
    font-size: 13px;
    color: var(--text-muted);
    padding: 4px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    transition: all .15s;
}
.topbar-logout:hover {
    color: var(--danger);
    border-color: var(--danger);
    text-decoration: none;
}

/* 内容区 */
.content {
    flex: 1;
    padding: 20px;
}

/* ========== 通用组件 ========== */
/* 页头 */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h1 { font-size: 20px; font-weight: 700; }

/* 卡片 */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}
.card-header h2 { font-size: 16px; font-weight: 600; }

/* 按钮 */
.btn {
    display: inline-block;
    padding: 7px 16px;
    border: 1px solid var(--border-color);
    background: #fff;
    color: var(--text-primary);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    text-decoration: none;
    transition: all .15s;
    line-height: 1.5;
}
.btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
}
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
}
.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
.btn-danger:hover {
    background: var(--danger-hover);
    border-color: var(--danger-hover);
    color: #fff;
}
.btn-block { width: 100%; }
.btn-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 13px;
    margin-right: 10px;
}
.btn-link:hover { text-decoration: underline; }

/* 表单 */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}
.form-group .req { color: var(--danger); }
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="datetime-local"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    transition: all .15s;
    background: #fff;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(43,124,255,.1);
}
.form-group select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23909399' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}
.form-group textarea { resize: vertical; }
.form-row {
    display: flex;
    gap: 16px;
}
.form-row .form-group { flex: 1; }
.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 10px;
}

/* 搜索栏 */
.search-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.search-bar input {
    flex: 1;
    max-width: 300px;
    padding: 7px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
}
.search-bar input:focus {
    outline: none;
    border-color: var(--primary);
}
.filter-select {
    padding: 7px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: inherit;
    background: #fff;
    min-width: 180px;
    cursor: pointer;
}
.filter-select:focus {
    outline: none;
    border-color: var(--primary);
}
.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ========== 富文本编辑器 ========== */
.editor-wrap {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
    background: #fff;
}
.editor-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(43,124,255,.1);
}
.editor-toolbar {
    border-bottom: 1px solid var(--border-color);
    background: #fafbfc;
}
.editor-body {
    min-height: 300px;
    overflow-y: auto;
}
.editor-body .w-e-text-container {
    z-index: 1;
}

/* 详情页富文本文章渲染 */
.rich-text {
    line-height: 1.8;
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-word;
}
.rich-text:empty::before {
    content: '暂无介绍';
    color: var(--text-muted);
}
.rich-text h1, .rich-text h2, .rich-text h3, .rich-text h4 {
    margin: 16px 0 8px;
    font-weight: 600;
    line-height: 1.4;
}
.rich-text h1 { font-size: 22px; }
.rich-text h2 { font-size: 18px; }
.rich-text h3 { font-size: 16px; }
.rich-text h4 { font-size: 15px; }
.rich-text p { margin: 8px 0; }
.rich-text ul, .rich-text ol {
    margin: 8px 0;
    padding-left: 24px;
}
.rich-text li { margin: 4px 0; }
.rich-text blockquote {
    margin: 12px 0;
    padding: 8px 16px;
    border-left: 4px solid var(--primary);
    background: var(--primary-light);
    color: var(--text-secondary);
}
.rich-text img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 8px 0;
}
.rich-text a {
    color: var(--primary);
    text-decoration: underline;
}
.rich-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}
.rich-text table th, .rich-text table td {
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    text-align: left;
}
.rich-text table th {
    background: #fafbfc;
    font-weight: 600;
}
.rich-text hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 16px 0;
}
.rich-text code {
    background: #f5f6f8;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    font-family: Consolas, Monaco, monospace;
}
.rich-text pre {
    background: #f5f6f8;
    padding: 12px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 12px 0;
}
.rich-text pre code {
    background: none;
    padding: 0;
}

/* ========== 地图选点 ========== */
.map-layout {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.map-container {
    flex: 1;
    height: 420px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    min-width: 0;
}
.map-detail { height: 380px; }
.map-sidebar {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.map-tip {
    padding: 8px 12px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius);
    font-size: 13px;
    text-align: center;
}
.region-count {
    font-size: 13px;
    color: var(--text-muted);
}
.region-count strong {
    color: var(--primary);
    font-size: 16px;
}

/* 待确认地点 */
.pending-region {
    background: #fffbe6;
    border: 1px solid #ffe58f;
    border-radius: var(--radius);
    padding: 12px;
}
.pending-title {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 10px;
    color: #d48806;
}
.pending-coord {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.pending-actions {
    display: flex;
    gap: 8px;
}
.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

/* 已选地点列表 */
.region-list-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}
.region-items {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 280px;
    overflow-y: auto;
}
.region-item {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 8px;
    background: #fafbfc;
}
.region-item-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.region-idx {
    width: 22px;
    height: 22px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.region-item-name {
    flex: 1;
    font-weight: 600;
    font-size: 13px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.region-del {
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    cursor: pointer;
    flex-shrink: 0;
}
.region-del:hover {
    background: var(--danger);
    color: #fff;
}
.region-item-addr {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 2px;
    padding-left: 30px;
}
.region-item-coord {
    font-size: 11px;
    color: var(--text-muted);
    padding-left: 30px;
}
.region-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-muted);
    font-size: 13px;
}

/* 地图警告 */
.map-warning {
    padding: 20px;
    background: #fff7e6;
    border: 1px solid #ffd591;
    border-radius: var(--radius);
    color: #d46b08;
}
.map-warning p { margin: 6px 0; font-size: 13px; }
.map-warning .tip { font-size: 12px; color: var(--text-muted); }

/* 详情页地点列表 */
.region-detail-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-top: 16px;
}
.region-detail-item {
    display: flex;
    gap: 10px;
    padding: 12px;
    background: #fafbfc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    align-items: flex-start;
}
.region-detail-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}
.region-detail-addr {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}
.region-detail-coord {
    font-size: 11px;
    color: var(--text-muted);
}

/* ========== 族谱树 ========== */
.tree-card { padding: 0; overflow: hidden; }
.tree-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 20px;
    border-bottom: 1px solid #ebeef5;
    background: #fafafa;
}
.tree-control-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 14px;
    color: #303133;
    user-select: none;
}
.tree-control-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #409eff;
}
.tree-control-tip {
    font-size: 12px;
    color: #909399;
}
.tree-layout {
    display: flex;
    height: calc(100vh - 170px);
    min-height: 500px;
}
.tree-zoom-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    cursor: grab;
    border-right: 1px solid var(--border-color);
}
.tree-zoom-container:active {
    cursor: grabbing;
}
.tree-container {
    transform-origin: 0 0;
    position: absolute;
    top: 0;
    left: 0;
    min-height: 500px;
}
.tree-detail {
    width: 320px;
    flex-shrink: 0;
    padding: 20px;
    overflow-y: auto;
    height: 100%;
}
.tree-detail-placeholder {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
    font-size: 14px;
}
.tree-empty {
    text-align: center;
    padding: 80px 20px;
}
.tree-empty-icon { font-size: 64px; margin-bottom: 16px; }
.tree-empty h3 { font-size: 18px; margin-bottom: 8px; color: var(--text-primary); }
.tree-empty p { color: var(--text-muted); margin-bottom: 20px; }

/* 树节点详情 */
.detail-header {
    display: flex;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}
.person-photo {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.person-photo-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    flex-shrink: 0;
}
.detail-title { flex: 1; min-width: 0; }
.detail-title h3 {
    font-size: 17px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.detail-sub { font-size: 12px; color: var(--text-muted); }
.badge-deceased {
    font-size: 11px;
    padding: 2px 8px;
    background: #f0f0f0;
    color: #999;
    border-radius: 10px;
    font-weight: normal;
}
.badge-alive {
    font-size: 11px;
    padding: 2px 8px;
    background: #e8f8ef;
    color: #27ae60;
    border-radius: 10px;
    font-weight: normal;
}
.detail-body { margin-bottom: 16px; }
.detail-row {
    display: flex;
    padding: 6px 0;
    font-size: 13px;
}
.detail-row .detail-label {
    width: 70px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.detail-row .detail-val { flex: 1; color: var(--text-primary); }
.spouse-tag {
    display: inline-block;
    padding: 2px 10px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 12px;
    font-size: 12px;
    margin-right: 4px;
    margin-bottom: 4px;
}
.detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* ========== 人员表单 ========== */
.person-basic {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.person-photo-area {
    width: 140px;
    flex-shrink: 0;
    text-align: center;
}
.photo-preview {
    width: 120px;
    height: 120px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafbfc;
}
.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-placeholder {
    color: var(--text-muted);
    font-size: 13px;
}
.photo-actions {
    display: flex;
    gap: 6px;
    justify-content: center;
    flex-wrap: wrap;
}
.person-fields { flex: 1; min-width: 0; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: normal;
}
.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 配偶列表 */
.spouse-list { margin-bottom: 8px; }
.spouse-item {
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 12px;
    background: #fafbfc;
}
.spouse-item-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border-color);
}

/* 响应式：族谱树 */
@media (max-width: 768px) {
    .tree-layout { flex-direction: column; }
    .tree-container { min-height: 350px; border-right: none; border-bottom: 1px solid var(--border-color); }
    .tree-detail { width: 100%; max-height: none; }
    .person-basic { flex-direction: column; }
    .person-photo-area { width: 100%; }
}

/* ========== 地图选点（单选） ========== */
.map-picker-field {
    display: flex;
    gap: 6px;
    align-items: center;
}
.map-picker-field input[readonly] {
    flex: 1;
    background: #f8f9fa;
    cursor: default;
}
.map-key-warning {
    font-size: 12px;
    color: #e67e22;
    padding: 4px 8px;
    background: #fef5e7;
    border-radius: 4px;
    white-space: nowrap;
}

/* 地图选点弹窗 */
.map-picker-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.map-picker-dialog {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.map-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
}
.map-picker-header h3 { font-size: 16px; margin: 0; }
.map-picker-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
}
.map-picker-close:hover { color: #333; }
.map-picker-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}
.map-picker-map {
    flex: 1;
    min-height: 400px;
}
.map-picker-info {
    width: 260px;
    flex-shrink: 0;
    padding: 16px;
    border-left: 1px solid var(--border-color);
    overflow-y: auto;
}
.picker-coord {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    padding: 6px 8px;
    background: #f8f9fa;
    border-radius: 4px;
    font-family: monospace;
}
.map-picker-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

@media (max-width: 768px) {
    .map-picker-body { flex-direction: column; }
    .map-picker-map { min-height: 250px; }
    .map-picker-info { width: 100%; border-left: none; border-top: 1px solid var(--border-color); }
}

/* ========== 密码验证弹窗 ========== */
.password-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.password-dialog {
    background: #fff;
    border-radius: 8px;
    width: 90%;
    max-width: 380px;
    padding: 24px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}
.password-dialog h3 {
    font-size: 17px;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.password-tip {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.password-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
    box-sizing: border-box;
}
.password-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(52,152,219,0.1);
}
.password-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ========== 配偶详情（族谱树） ========== */
.spouse-detail-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.spouse-detail-item {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 6px 8px;
    background: #f8f9fa;
    border-radius: 6px;
}
.spouse-detail-photo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}
.spouse-photo-default {
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}
.spouse-detail-info { flex: 1; min-width: 0; }
.spouse-detail-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}
.spouse-detail-dates {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ========== 配偶表单布局 ========== */
.spouse-item-body {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.spouse-photo-col {
    width: 100px;
    flex-shrink: 0;
    text-align: center;
}
.spouse-photo-preview {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border-color);
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafbfc;
}
.spouse-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.spouse-photo-preview .photo-placeholder {
    font-size: 11px;
    color: var(--text-muted);
}
.spouse-photo-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
}
.spouse-photo-actions .btn {
    width: 100%;
    font-size: 11px;
    padding: 4px 8px;
}
.spouse-fields-col {
    flex: 1;
    min-width: 0;
}

@media (max-width: 600px) {
    .spouse-item-body { flex-direction: column; }
    .spouse-photo-col { width: 100%; }
    .spouse-photo-actions { flex-direction: row; justify-content: center; }
    .spouse-photo-actions .btn { width: auto; }
}

/* 表格 */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.table th, .table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}
.table th {
    background: #fafbfc;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    font-size: 12px;
}
.table tr:hover { background: #f8faff; }
.table .ellipsis {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 统计卡片 */
.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}
.stat-card {
    flex: 1;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    text-align: center;
    border-top: 3px solid var(--primary);
}
.stat-num {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.2;
}
.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* 详情页 */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 16px;
}
.detail-item { margin-bottom: 12px; }
.detail-item.full { grid-column: 1 / -1; }
.detail-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.detail-value { font-size: 14px; }
.intro-text {
    white-space: pre-wrap;
    line-height: 1.8;
    background: #fafbfc;
    padding: 14px;
    border-radius: var(--radius);
    border: 1px solid #f0f0f0;
}
.region-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.region-list li {
    padding: 5px 12px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 20px;
    font-size: 13px;
}

/* 危险区 */
.danger-zone {
    margin-top: 16px;
    padding: 14px 16px;
    background: #fff5f5;
    border: 1px solid #ffccc7;
    border-radius: var(--radius);
}

/* 提示消息 */
.flash {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    font-size: 13px;
    border: 1px solid transparent;
}
.flash-success {
    background: #f6ffed;
    border-color: #b7eb8f;
    color: #389e0d;
}
.flash-error {
    background: #fff2f0;
    border-color: #ffccc7;
    color: #cf1322;
}

/* 空状态 */
.empty {
    text-align: center;
    padding: 36px;
    color: var(--text-muted);
    font-size: 14px;
}

/* ========== 响应式 ========== */
/* 平板及以下：侧边栏抽屉式 */
@media (max-width: 992px) {
    .detail-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    :root { --sidebar-width: 210px; }

    /* 侧边栏变为抽屉 */
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 2px 0 12px rgba(0,0,0,.15);
    }
    .sidebar.open { transform: translateX(0); }

    /* 主区域占满 */
    .main-wrapper { margin-left: 0; }

    /* 显示汉堡按钮 */
    .menu-toggle { display: flex; }

    /* 登录页堆叠 */
    .login-page { flex-direction: column; }
    .login-brand {
        flex: none;
        padding: 32px 20px;
        min-height: auto;
    }
    .brand-inner { padding: 0; }
    .brand-features { display: none; }
    .brand-slogan { margin-bottom: 0; font-size: 15px; }
    .brand-logo h1 { font-size: 20px; }
    .login-form-wrap { padding: 28px 20px; }

    /* 表单行堆叠 */
    .form-row { flex-direction: column; gap: 0; }

    /* 统计卡片堆叠 */
    .stats-row { flex-direction: column; }

    /* 详情网格单列 */
    .detail-grid { grid-template-columns: 1fr; }

    /* 表格横向滚动 */
    .card { overflow-x: auto; }
    .table { min-width: 600px; }

    /* 内容区padding减小 */
    .content { padding: 14px; }

    /* 地图布局纵向排列 */
    .map-layout { flex-direction: column; }
    .map-sidebar { width: 100%; }
    .map-container { height: 320px; }

    /* 顶部栏 */
    .topbar { padding: 0 14px; }
    .topbar-username { display: none; }
}

@media (max-width: 480px) {
    .page-header h1 { font-size: 17px; }
    .login-form-card h2 { font-size: 22px; }
    .btn { padding: 6px 12px; font-size: 12px; }
}


/* ========== 菜单管理 ========== */

/* 菜单图标上传 */
.menu-icon-upload { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.menu-icon-preview {
    width: 80px; height: 80px; border: 2px dashed #dcdfe6; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    background: #fafafa; flex-shrink: 0;
}
.menu-icon-preview img { width: 100%; height: 100%; object-fit: contain; }
.menu-icon-placeholder { display: flex; flex-direction: column; align-items: center; gap: 4px; color: #c0c4cc; font-size: 12px; }
.menu-icon-plus { font-size: 24px; line-height: 1; }
.menu-icon-actions { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.form-hint { color: #909399; font-size: 12px; margin-top: 6px; width: 100%; }

/* 菜单列表图标 */
.menu-icon-img { width: 36px; height: 36px; object-fit: contain; border-radius: 4px; vertical-align: middle; }
.menu-icon-empty { color: #c0c4cc; font-size: 18px; }

/* Switch 开关 */
.switch-row { display: flex; align-items: center; gap: 12px; }
.switch { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-slider {
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0;
    background-color: #c0c4cc; transition: .3s; border-radius: 26px;
}
.switch-slider:before {
    position: absolute; content: ''; height: 20px; width: 20px; left: 3px; bottom: 3px;
    background-color: white; transition: .3s; border-radius: 50%;
}
.switch input:checked + .switch-slider { background-color: #67c23a; }
.switch input:checked + .switch-slider:before { transform: translateX(22px); }
.switch-label { font-size: 14px; color: #606266; }


/* 筛选栏 */
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; padding: 12px 16px; background: #f5f7fa; border-radius: 6px; }
.filter-label { font-size: 13px; color: #606266; font-weight: 500; }
.filter-tag { display: inline-block; padding: 4px 14px; font-size: 13px; color: #606266; background: #fff; border: 1px solid #dcdfe6; border-radius: 4px; text-decoration: none; transition: all .2s; }
.filter-tag:hover { color: #409eff; border-color: #409eff; }
.filter-tag.active { color: #fff; background: #409eff; border-color: #409eff; }

/* 蓝色徽章 */
.badge-blue { background: #ecf5ff; color: #409eff; }
