:root { --bg:#faf8f4; --fg:#2b2620; --muted:#7a7068; --card:#fff; --line:#e6e0d6; --accent:#5b7c3a; --accent-fg:#fff;
  --danger:#b3261e; --m:#dbe7f3; --f:#f6dfe6; --radius:10px; color-scheme: light dark; }
@media (prefers-color-scheme: dark) { :root { --bg:#1d1b18; --fg:#ece6dc; --muted:#a39a8f; --card:#27241f; --line:#3a352e;
  --accent:#8db35f; --accent-fg:#14130f; --m:#2a3a4a; --f:#4a2f38; } }
* { box-sizing: border-box; }
body { margin:0; font:16px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background:var(--bg); color:var(--fg); }
a { color: var(--accent); }
.topbar { display:flex; justify-content:space-between; align-items:center; gap:1rem; flex-wrap:wrap; padding:.7rem 1rem; border-bottom:1px solid var(--line); background:var(--card); }
.topbar nav { display:flex; gap:1rem; align-items:center; flex-wrap:wrap; }
.brand { font-weight:700; text-decoration:none; color:var(--fg); }
.container { max-width:1100px; margin:0 auto; padding:1rem; }
.wide { padding:1rem; }
.narrow { max-width:640px; margin:1rem auto; }
.card { background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:1rem 1.25rem; margin-bottom:1rem; }
.grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(240px, 1fr)); gap:1rem; }
.cols { display:grid; grid-template-columns:repeat(auto-fit, minmax(320px, 1fr)); gap:1rem; }
.tree-card { text-decoration:none; color:inherit; } .tree-card:hover { border-color:var(--accent); }
.row-between { display:flex; justify-content:space-between; align-items:center; gap:1rem; flex-wrap:wrap; }
.btn { display:inline-block; background:var(--accent); color:var(--accent-fg); border:0; border-radius:8px; padding:.5rem 1rem; text-decoration:none; cursor:pointer; font:inherit; }
.btn.small { padding:.25rem .6rem; font-size:.9rem; } .btn.ghost { background:transparent; color:var(--accent); border:1px solid var(--accent); }
.btn.danger { background:var(--danger); color:#fff; } .danger { color:var(--danger); }
button.link { background:none; border:0; color:var(--accent); cursor:pointer; font:inherit; padding:0; }
form.inline { display:inline; }
.field { margin-bottom:.8rem; } .field label { display:block; font-weight:600; margin-bottom:.2rem; }
input:not([type=checkbox]), select, textarea { width:100%; padding:.5rem; border:1px solid var(--line); border-radius:6px; background:var(--bg); color:var(--fg); font:inherit; }
.field small, .muted { color:var(--muted); } .err { color:var(--danger); font-size:.9rem; }
.search { display:flex; gap:.5rem; margin:1rem 0; } .search input { flex:1; }
.table { width:100%; border-collapse:collapse; } .table td, .table th { padding:.45rem; border-bottom:1px solid var(--line); text-align:left; }
.badge { font-size:.75rem; padding:.1rem .5rem; border-radius:99px; background:var(--line); vertical-align:middle; font-weight:500; }
.badge.public { background:#d8ead0; color:#2e5a1c; } .badge.link { background:#f3e7c7; color:#6a4f09; } .badge.private { background:#e9e2f2; color:#4b3770; }
.messages { list-style:none; padding:0; } .msg { padding:.6rem 1rem; border-radius:8px; margin-bottom:.5rem; background:var(--card); border-left:4px solid var(--accent); }
.msg.error { border-color:var(--danger); }
.tree-head h1 { margin-bottom:.3rem; } .tabs { display:flex; gap:1rem; flex-wrap:wrap; margin-bottom:1rem; border-bottom:1px solid var(--line); padding-bottom:.5rem; }
.person-head { display:flex; gap:1.25rem; align-items:center; } .portrait { width:120px; height:120px; object-fit:cover; border-radius:50%; }
.timeline { list-style:none; padding-left:0; } .timeline li { padding:.4rem 0; border-bottom:1px dashed var(--line); }
.gallery { display:flex; flex-wrap:wrap; gap:.75rem; } .thumb { width:140px; text-decoration:none; color:inherit; font-size:.85rem; }
.thumb img { width:140px; height:140px; object-fit:cover; border-radius:6px; display:block; } .doc { font-size:3rem; display:block; text-align:center; }
.viewer { overflow:hidden; height:70vh; background:#111; border-radius:8px; cursor:grab; touch-action:none; display:flex; align-items:center; justify-content:center; }
.viewer img { max-width:100%; max-height:100%; transform-origin:center; user-select:none; -webkit-user-drag:none; }
.copy { font-family:monospace; } .hero { padding:2rem 0; } .hero h1 { font-size:2rem; } .prose h2 { margin-top:1.5rem; }
.footer { text-align:center; padding:2rem 1rem; color:var(--muted); font-size:.9rem; }
.chart-box { width:100%; height:72vh; border-radius:var(--radius); background:#2b2b2b; color:#fff; }
.chart-panel { position:sticky; bottom:0; display:flex; gap:.6rem; align-items:center; flex-wrap:wrap; background:var(--card); border:1px solid var(--line); border-radius:var(--radius); padding:.6rem 1rem; margin-top:.5rem; }
.fc-card { display:flex; gap:.5rem; align-items:center; width:210px; min-height:70px; padding:.4rem; border-radius:8px; color:#1e1e1e; cursor:pointer; }
.fc-m { background:#dbe7f3; } .fc-f { background:#f6dfe6; } .fc-hidden { background:#ccc; font-style:italic; }
.fc-avatar { width:50px; height:50px; border-radius:50%; object-fit:cover; flex:none; } .fc-noimg { background:rgba(0,0,0,.12); }
.fc-name { font-weight:600; font-size:.9rem; line-height:1.15; } .fc-last { font-size:.85rem; } .fc-dates { font-size:.75rem; color:#555; }
@media (max-width:600px) { .person-head { flex-direction:column; text-align:center; } .chart-box { height:60vh; } }
