* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --card: #fff; --stroke: rgba(0,0,0,.08); --text: #2b2a27; --text-2: #8a857c;
  --accent: #4a8a52; --accent-soft: rgba(74,138,82,.12); --danger: #e25555;
  --shadow: 0 8px 28px rgba(40,60,40,.12); --radius: 18px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text); min-height: 100vh;
}
body::before { content:''; position:fixed; inset:0; z-index:-2;
  background:url('/img/forest.png') center/cover no-repeat #2f4030; }
body::after { content:''; position:fixed; inset:0; z-index:-1;
  background:rgba(244,247,242,.82); backdrop-filter:blur(2px); }
[hidden] { display: none !important; }

.topbar {
  display:flex; align-items:center; gap:12px; padding:14px 20px;
  background:rgba(255,255,255,.75); backdrop-filter:blur(12px);
  border-bottom:1px solid var(--stroke); position:sticky; top:0; z-index:20;
}
.badge { background:var(--accent-soft); color:var(--accent); padding:3px 12px;
  border-radius:999px; font-size:13px; font-weight:700; }
.btn { padding:10px 18px; border:none; border-radius:12px; background:var(--accent);
  color:#fff; font-weight:600; cursor:pointer; font-family:inherit; font-size:14px; }
.btn.small { padding:8px 14px; font-size:13px; }
.btn.ghost { background:var(--accent-soft); color:var(--text); }
.btn.danger { background:var(--danger); }

#tree-wrap { overflow:auto; height:calc(100vh - 60px); }
#tree { display:block; margin:0 auto; }
.tnode { cursor:pointer; }
.tnode circle.ph { fill:#fff; stroke:var(--stroke); stroke-width:2; }
.tnode.selected circle.ph { stroke:var(--accent); stroke-width:3; }
.tnode text.nm { font-size:13px; font-weight:600; fill:var(--text); text-anchor:middle; }
.tnode text.dt { font-size:11px; fill:var(--text-2); text-anchor:middle; }
.tplus circle { fill:rgba(255,255,255,.7); stroke:var(--text-2); stroke-dasharray:4 3; }
.tplus text { font-size:24px; fill:var(--text-2); text-anchor:middle; }
.tline { stroke:#b9c4b6; stroke-width:2; fill:none; }
.tline.dash { stroke-dasharray:4 4; opacity:.5; }

#card {
  position:fixed; top:76px; right:16px; width:340px; max-height:calc(100vh - 100px);
  overflow:auto; background:var(--card); border:1px solid var(--stroke);
  border-radius:var(--radius); box-shadow:var(--shadow); padding:18px; z-index:30;
}
#card img.photo { width:110px; height:110px; border-radius:50%; object-fit:cover; display:block; margin:0 auto 10px; }
#card .rel a { display:block; padding:6px 0; color:var(--accent); text-decoration:none; font-size:14px; }
#card input, #card select, #card textarea {
  width:100%; padding:10px 12px; margin-bottom:10px; border:1px solid var(--stroke);
  border-radius:10px; font:inherit; font-size:14px;
}
#card label { font-size:12px; color:var(--text-2); }

#login-modal { position:fixed; inset:0; background:rgba(0,0,0,.45);
  display:flex; align-items:center; justify-content:center; z-index:50; }
.modal-box { background:var(--card); border-radius:var(--radius); box-shadow:var(--shadow);
  padding:22px; width:320px; }
.modal-box input { width:100%; padding:11px; margin:12px 0 4px; border:1px solid var(--stroke); border-radius:10px; font:inherit; }

@media (max-width:700px) {
  #card { left:10px; right:10px; width:auto; top:auto; bottom:10px; max-height:70vh; }
}
/* ===== Шапка с центром ===== */
.topbar { gap:10px; }
.tb-side { flex:1; display:flex; align-items:center; gap:10px; min-width:0; }
.seg { display:flex; background:var(--accent-soft); border-radius:12px; padding:4px; }
.seg-btn { padding:8px 22px; border:none; background:transparent; border-radius:9px;
  font:inherit; font-size:14px; font-weight:600; color:var(--text-2); cursor:pointer; }
.seg-btn.active { background:#fff; color:var(--accent); box-shadow:0 2px 8px rgba(0,0,0,.08); }

/* ===== Страница «Люди» ===== */
#people-wrap { max-width:860px; margin:0 auto; padding:26px 16px 60px; }
.pp-title { text-align:center; margin-bottom:18px; }
.pp-panel { background:rgba(255,255,255,.75); backdrop-filter:blur(12px);
  border:1px solid var(--stroke); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:18px; margin-bottom:20px; }
.pp-row { display:flex; gap:10px; flex-wrap:wrap; }
.pp-row input { flex:1; min-width:140px; padding:11px 14px; border:1px solid var(--stroke);
  border-radius:12px; font:inherit; font-size:14px; }
.chipbtn { padding:9px 16px; border:1px solid var(--stroke); border-radius:999px;
  background:#fff; font:inherit; font-size:13px; font-weight:600; color:var(--text-2); cursor:pointer; }
.chipbtn.on { border-color:var(--accent); color:var(--accent); background:var(--accent-soft); }
.chip-pop { display:flex; gap:8px; align-items:center; margin-top:10px;
  padding:12px; background:var(--accent-soft); border-radius:12px; }
.chip-pop input { width:70px; padding:9px; border:1px solid var(--stroke);
  border-radius:10px; font:inherit; text-align:center; }
.chip-pop input.y { width:90px; }
.pp-find { width:100%; margin-top:14px; }
.pp-grid { display:grid; grid-template-columns:repeat(4,1fr); gap:14px; }
.pp-card { background:#fff; border:1px solid var(--stroke); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:16px 10px; text-align:center; cursor:pointer;
  transition:transform .15s; }
.pp-card:hover { transform:translateY(-3px); }
.pp-card img, .pp-card .ava { width:64px; height:64px; border-radius:50%;
  object-fit:cover; margin:0 auto 8px; display:flex; align-items:center;
  justify-content:center; font-size:34px; background:var(--accent-soft); }
.pp-card strong { font-size:13px; display:block; }
.pp-card small { color:var(--text-2); font-size:11px; }
.pp-card.add { border-style:dashed; box-shadow:none; background:transparent;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  color:var(--accent); font-weight:700; min-height:130px; }
.pp-pag { display:flex; gap:6px; justify-content:center; margin-top:20px; }
.pp-pag button { width:36px; height:36px; border:1px solid var(--stroke); border-radius:10px;
  background:#fff; font:inherit; cursor:pointer; }
.pp-pag button.cur { background:var(--accent); color:#fff; border-color:var(--accent); }
@media (max-width:700px){ .pp-grid{grid-template-columns:repeat(2,1fr);} .tb-side strong{display:none;} }

/* ===== Поиск-выбор профиля в форме ===== */
.picker { position:relative; margin-bottom:10px; }
.picker input { margin-bottom:0 !important; }
.picker-list { position:absolute; left:0; right:0; top:100%; z-index:40;
  background:#fff; border:1px solid var(--stroke); border-radius:12px;
  box-shadow:var(--shadow); max-height:200px; overflow:auto; }
.picker-list div { padding:9px 12px; cursor:pointer; font-size:14px; }
.picker-list div:hover { background:var(--accent-soft); }
.picker-list small { color:var(--text-2); }
.pp-card { position: relative; }
.ppc-del { position:absolute; top:6px; right:6px; border:none; background:none;
  cursor:pointer; opacity:.35; font-size:13px; }
.ppc-del:hover { opacity:1; color:var(--danger); }
