/* Family archive look: deep green + gold + cream, with Nubian motifs
   (wall-painting triangles, arched doors, domed houses). */
:root {
  --green: #1e4631;
  --green-2: #2d5a3d;
  --green-3: #3f7a54;
  --dark: #142e20;
  --gold: #c9a227;
  --gold-2: #d4af37;
  --gold-3: #e8c96a;
  --cream: #faf5ea;
  --beige: #f3ead8;
  --beige-2: #ece0c8;
  --beige-3: #dcc9a3;
  --brown: #6b4f2e;
  --ink: #2a2318;
  --muted: #8a6d45;
  --pink: #fbeaf0;
  --pink-2: #c2547a;
  --danger: #8c2f24;
  --radius: 14px;
  --shadow: 0 10px 26px rgba(42, 35, 24, .12);
  --shadow-lg: 0 20px 44px rgba(30, 70, 49, .22);
  --font-body: "Zain", system-ui, sans-serif;
  --font-head: "Aref Ruqaa", "Zain", serif;
  /* Nubian painted-wall triangles */
  --tri: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='10'%3E%3Cpath d='M0 10 6 2 12 10Z' fill='%23c9a227'/%3E%3Ccircle cx='18' cy='6' r='1.6' fill='%23c9a227'/%3E%3C/svg%3E");
  --zig: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='12'%3E%3Cpath d='M0 12 11 0 22 12Z' fill='%23f3ead8'/%3E%3C/svg%3E");
  --dash: repeating-linear-gradient(90deg, var(--green) 0 14px, var(--gold) 14px 18px);
  --lattice: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36'%3E%3Cpath d='M18 4 32 18 18 32 4 18Z' fill='none' stroke='%23c9a227' stroke-opacity='.22' stroke-width='1.2'/%3E%3Ccircle cx='18' cy='18' r='2' fill='%23c9a227' fill-opacity='.3'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; }
body {
  font-family: var(--font-body); font-size: 17px; line-height: 1.7;
  background: var(--beige); color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; line-height: 1.4; color: var(--green); }
a { color: var(--green-2); }
img { max-width: 100%; display: block; }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; }

/* ---------- header ---------- */
.chrome { position: sticky; top: 0; z-index: 120; background: var(--green); box-shadow: 0 4px 14px rgba(0,0,0,.18); }
.chrome-inner { display: flex; align-items: center; gap: 12px; padding: 12px 5vw; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--gold-3); text-decoration: none; min-width: 0; }
.brand b { font: 700 1.55rem var(--font-head); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.emblem { width: 40px; height: 40px; flex: none; display: block; object-fit: contain; }
.spacer { flex: 1; }
.chrome-band { height: 10px; background: var(--dark) var(--tri) repeat-x center/24px 10px; border-top: 1px solid rgba(201,162,39,.4); }

.edit-toggle {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 8px 6px 14px;
  border-radius: 999px; border: 1.5px solid var(--gold); background: transparent;
  color: var(--gold-3); font: 700 .95rem var(--font-body); cursor: pointer;
}
.edit-toggle .sw { width: 42px; height: 22px; border-radius: 11px; background: var(--dark); position: relative; transition: .2s; }
.edit-toggle .sw::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--beige-3); transition: .2s; }
.edit-toggle[aria-pressed="true"] .sw { background: var(--gold); }
.edit-toggle[aria-pressed="true"] .sw::after { inset-inline-start: 23px; background: #fff; }
.menu-btn { width: 44px; height: 44px; border-radius: 10px; border: 1.5px solid var(--gold); background: transparent; color: var(--gold-3); cursor: pointer; display: grid; place-items: center; position: relative; }
.menu-btn .dot { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .7rem; line-height: 18px; }
.menu { position: absolute; top: 64px; inset-inline-start: 5vw; background: var(--cream); border: 1px solid var(--gold); border-radius: 12px; box-shadow: var(--shadow-lg); min-width: 220px; overflow: hidden; z-index: 130; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px 16px; border: 0; background: none; font: 700 1rem var(--font-body); color: var(--green); text-decoration: none; cursor: pointer; text-align: start; }
.menu a:hover, .menu button:hover { background: var(--beige-2); }

/* ---------- hero ---------- */
.hero { position: relative; min-height: min(78vh, 680px); display: grid; place-items: center; text-align: center; color: #fff; overflow: hidden; background: var(--dark) url(/hero.webp) center 62%/cover no-repeat; }
@media (max-width: 760px) { .hero { background-image: url(/hero-sm.webp); background-position: 58% center; } }
.hero svg.scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(0,0,0,.25), rgba(0,0,0,.5) 75%), linear-gradient(180deg, rgba(20,30,20,.25), rgba(20,30,20,.15) 40%, rgba(20,30,20,.55)); }
.hero-in { position: relative; z-index: 2; padding: 60px 5vw 90px; max-width: 900px; }
.hero h1 { color: var(--gold-3); font-size: clamp(2.3rem, 7vw, 4.6rem); margin: 10px 0 6px; text-shadow: 0 4px 18px rgba(0,0,0,.45); }
.hero p { font-size: clamp(1.05rem, 2.4vw, 1.45rem); margin: 0; font-weight: 700; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.hero .founder { color: var(--gold-3); font: 700 1.7rem var(--font-head); margin-top: 6px; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.hero .emblem { width: 110px; height: 110px; margin: 0 auto; filter: drop-shadow(0 6px 16px rgba(0,0,0,.4)); }
.orn { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 18px auto; width: 220px; }
.orn::before, .orn::after { content: ""; flex: 1; height: 2px; background: linear-gradient(90deg, transparent, var(--gold)); }
.orn::after { transform: scaleX(-1); }
.orn i { width: 10px; height: 10px; background: var(--gold); transform: rotate(45deg); }
.scroll-cue { display: inline-flex; flex-direction: column; align-items: center; margin-top: 30px; color: var(--gold-3); font-weight: 800; text-decoration: none; }
.hero-edge { position: absolute; bottom: -1px; inset-inline: 0; height: 14px; z-index: 3; background: var(--zig) repeat-x bottom/22px 12px; }

/* ---------- section heads ---------- */
.section { padding: 40px 5vw 60px; scroll-margin-top: 60px; }
.sec-head { text-align: center; margin-bottom: 26px; }
.sec-head h2 { font-size: clamp(2rem, 5vw, 3rem); margin: 0; }
.sec-head .bar { width: 70px; height: 3px; margin: 10px auto 14px; border-radius: 2px; background: linear-gradient(90deg, var(--gold), var(--green-3)); }
.sec-head p { margin: 0; color: var(--brown); font-weight: 700; }

/* ---------- tree panel ---------- */
.tree-panel { max-width: 1280px; margin: 0 auto; background: var(--cream); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; position: relative; }
.tree-panel::before { content: ""; display: block; height: 7px; background: var(--dash); }
.tree-panel.full { position: fixed; inset: 0; z-index: 150; max-width: none; border-radius: 0; display: flex; flex-direction: column; }
.tree-panel.full .tree-stage { flex: 1; height: auto; }
.tree-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 20px; border-bottom: 1px solid var(--beige-2); }
.crumbs { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 200px; color: var(--green); }
.crumbs button { border: 0; background: none; font: 800 1rem var(--font-body); color: var(--green); cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.crumbs button:hover { background: var(--beige-2); }
.crumbs .chev { color: var(--gold); font-size: .8rem; }
.pill { display: inline-block; padding: 1px 12px; border-radius: 999px; background: var(--beige-2); color: var(--brown); font-weight: 700; font-size: .85rem; border: 1px solid var(--beige-3); white-space: nowrap; }
.tools { display: flex; gap: 10px; flex-wrap: wrap; }
.search { position: relative; }
.search label { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--beige-3); background: #fff; border-radius: 10px; padding: 0 12px; width: min(270px, 80vw); color: var(--muted); }
.search input { border: 0; outline: 0; padding: 9px 0; font: 1rem var(--font-body); width: 100%; background: none; }
.results { position: absolute; top: calc(100% + 6px); inset-inline: 0; background: #fff; border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 50vh; overflow: auto; z-index: 30; border: 1px solid var(--beige-3); }
.results button { display: block; width: 100%; text-align: start; border: 0; background: none; padding: 10px 14px; font: 1rem var(--font-body); cursor: pointer; color: var(--ink); }
.results button:hover, .results button:focus { background: var(--beige); }
.show-all { display: inline-flex; align-items: center; gap: 8px; border: 1.5px solid var(--gold); background: #fff; color: var(--green); border-radius: 10px; padding: 8px 14px; font: 800 .95rem var(--font-body); cursor: pointer; }
.show-all[aria-pressed="true"] { background: var(--green); color: var(--gold-3); border-color: var(--green); }

.tree-stage { position: relative; height: min(70vh, 720px); background: var(--cream) var(--lattice); overflow: hidden; touch-action: none; cursor: grab; }
.tree-stage.dragging { cursor: grabbing; }
.canvas { position: absolute; top: 0; left: 0; transform-origin: 0 0; padding: 30px 40px 50px; }
.tree-footer { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; padding: 10px 20px; border-top: 1px solid var(--beige-2); }
.hint { display: flex; align-items: center; gap: 8px; color: var(--brown); font-weight: 700; font-size: .9rem; }
.live { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgba(201,162,39,.2); }
.zoom { display: flex; align-items: center; gap: 6px; direction: ltr; }
.zoom button { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--beige-3); background: #fff; color: var(--green); cursor: pointer; display: grid; place-items: center; font-size: 1.1rem; }
.zoom span { min-width: 48px; text-align: center; font-weight: 800; color: var(--green); }

/* org-chart connectors (logical properties keep it correct in RTL) */
.tree ul { display: flex; justify-content: center; margin: 0; padding: 30px 0 0; position: relative; }
.tree li { list-style: none; position: relative; padding: 30px 10px 0; display: flex; flex-direction: column; align-items: center; }
.tree li::before, .tree li::after { content: ""; position: absolute; top: 0; width: 50%; height: 30px; border-top: 2px solid var(--gold); }
.tree li::before { inset-inline-end: 50%; }
.tree li::after { inset-inline-start: 50%; border-inline-start: 2px solid var(--gold); }
.tree li:only-child::before { display: none; }
.tree li:only-child::after { border-top: 0; }
.tree li:first-child::before { border-top: 0; }
.tree li:last-child::after { border-top: 0; }
.tree ul ul::before { content: ""; position: absolute; top: 0; inset-inline-start: 50%; height: 30px; border-inline-start: 2px solid var(--gold); }
.tree > ul { padding-top: 0; }
.tree > ul > li { padding-top: 0; }
.tree > ul > li::before, .tree > ul > li::after { display: none; }
.tree li.collapsed > ul { display: none; }

/* person card */
.pcard {
  position: relative; width: 158px; background: #fffdf8; border: 1.5px solid var(--beige-3); border-radius: 6px;
  box-shadow: 0 4px 12px rgba(42,35,24,.08); text-align: center; overflow: hidden; transition: transform .15s, box-shadow .15s;
}
.pcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.pcard.f { background: var(--pink); border-color: #ecc5d3; }
.pcard.focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,39,.25), var(--shadow); }
.pcard.hit { box-shadow: 0 0 0 4px var(--gold), var(--shadow-lg); }
.pcard .top { padding: 16px 8px 10px; cursor: pointer; }
.pcard .tag { position: absolute; top: 0; left: 50%; transform: translateX(-50%); background: var(--green); color: var(--gold-3); font-weight: 800; font-size: .75rem; padding: 2px 12px; border-radius: 0 0 6px 6px; border: 1px solid var(--gold); border-top: 0; white-space: nowrap; }
.pcard.root .top { padding-top: 26px; }
.av { width: 54px; height: 54px; border-radius: 50%; margin: 0 auto 6px; background: var(--beige-2) center/cover no-repeat; display: grid; place-items: center; color: var(--beige-3); border: 2px solid #fff; box-shadow: 0 0 0 1.5px var(--beige-3); }
.f .av { background-color: #f6d9e3; color: #e2a9bd; }
.av svg { width: 60%; height: 60%; }
.av.lg { width: 120px; height: 120px; border: 4px solid var(--gold); box-shadow: 0 8px 20px rgba(0,0,0,.15); }
.pcard .nm { font: 700 1.2rem var(--font-head); color: var(--green); line-height: 1.35; word-break: break-word; }
.f .nm { color: #7a2346; }
.pcard .mom { font-size: .85rem; font-weight: 700; color: var(--muted); margin-top: 2px; }
.pcard .sub { font-size: .78rem; color: var(--muted); line-height: 1.5; }
.pcard .role { margin: 4px 8px 0; padding-top: 4px; border-top: 1px solid var(--beige-2); font-size: .8rem; font-weight: 800; color: var(--green-2); }
.f .role { color: var(--pink-2); border-color: #f0cfdb; }
.pcard .rows button { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; border: 0; border-top: 1px solid var(--beige-2); background: none; padding: 7px 4px; font: 700 .82rem var(--font-body); color: var(--brown); cursor: pointer; }
.f .rows button { border-color: #f0cfdb; }
.pcard .rows button:hover:not([disabled]) { background: rgba(201,162,39,.12); }
.pcard .rows button[disabled] { opacity: .45; cursor: default; }
.pcard .rows button.on { background: rgba(63,122,84,.12); color: var(--green); }
.pcard .rows svg { width: 14px; height: 14px; color: var(--gold); }
.pcard .add { position: absolute; top: 6px; inset-inline-start: 6px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--gold); background: var(--green); color: var(--gold-3); cursor: pointer; font-size: 1rem; line-height: 1; display: grid; place-items: center; }
.parent-ghost .pcard { opacity: .75; transform: scale(.92); }
/* small card under the mother: the child's real card is under the father */
.pcard.mini, .pcard.mini.f { width: 118px; padding: 10px 6px 0; cursor: pointer; background: #e9f0f7; border: 1.5px dashed #8fa9c7; box-shadow: none; }
.pcard.mini:hover { background: #dde8f3; }
.pcard.mini .av { width: 36px; height: 36px; margin-bottom: 4px; }
.pcard.mini .nm, .pcard.mini.f .nm { font-size: 1rem; color: #2f4a68; }
.pcard.mini .mom { font-size: .8rem; color: #4d6683; }
.pcard.mini .jump { margin-top: 6px; padding: 4px 2px; border-top: 1px dashed #b5c6da; font-size: .7rem; font-weight: 800; color: #4d6683; }
.tree li.mirror::before, .tree li.mirror::after { border-top-style: dashed; }
.tree li.mirror::after { border-inline-start-style: dashed; }

.empty { max-width: 460px; margin: 60px auto; text-align: center; background: #fff; border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow); }

/* ---------- buttons & form ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px;
  padding: 10px 24px; border-radius: 999px; border: 1.5px solid var(--green); cursor: pointer; text-decoration: none;
  background: var(--green); color: var(--gold-3); font: 800 1rem var(--font-body); box-shadow: 0 6px 14px rgba(30,70,49,.25);
}
.btn:hover { background: var(--green-2); }
.btn.ghost { background: transparent; color: var(--green); border-color: var(--gold); box-shadow: none; }
.btn.ghost:hover { background: rgba(201,162,39,.1); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.wa { background: #1f9d55; border-color: #1f9d55; color: #fff; }
.btn.sm { min-height: 38px; padding: 6px 16px; font-size: .9rem; }
.btn[disabled] { opacity: .55; cursor: default; }

label.f-label { display: block; font: 800 .95rem var(--font-body); color: var(--green); margin: 14px 0 6px; }
label.f-label .req { color: var(--danger); }
label.f-label .opt { color: var(--muted); font-weight: 400; font-size: .85rem; }
.inp, input[type=text], input[type=tel], input[type=number], input[type=password], input[type=search].inp, select, textarea {
  width: 100%; font: 1.02rem var(--font-body); color: var(--ink); padding: 10px 14px;
  border: 1.5px solid var(--beige-3); border-radius: 10px; background: rgba(255,255,255,.75);
}
select { appearance: none; background: rgba(255,255,255,.75) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23c9a227' stroke-width='2'/%3E%3C/svg%3E") no-repeat left 14px center; padding-left: 36px; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,39,.2); background-color: #fff; }
textarea { min-height: 110px; resize: vertical; }
.help { font-size: .82rem; color: var(--brown); margin-top: 4px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.drop { border: 2px dashed var(--gold-3); border-radius: 12px; padding: 14px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: rgba(255,255,255,.4); }
.drop .av { margin: 0; width: 72px; height: 72px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--danger); margin-top: 8px; }
.err { color: var(--danger); font-weight: 800; min-height: 1.4em; margin-top: 10px; }
.code-input { text-align: center; letter-spacing: .5em; font-size: 1.6rem !important; direction: ltr; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 200; background: rgba(20,46,32,.55); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade .2s; }
.modal-box {
  position: relative; width: min(740px, 100%); max-height: calc(100vh - 32px); overflow: auto;
  background: linear-gradient(180deg, #fbf5e8, #efe3c9); border: 2px solid var(--gold); border-radius: 22px;
  box-shadow: 0 30px 70px rgba(0,0,0,.35); padding: 28px 30px 26px; animation: pop .22s ease-out;
}
.modal-box.narrow { width: min(560px, 100%); }
.modal-close { position: sticky; top: 0; float: left; margin: -12px -14px 0 0; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--green); color: var(--gold-3); cursor: pointer; font-size: 1.1rem; z-index: 5; }
.modal-title { text-align: center; font-size: clamp(1.5rem, 4vw, 2rem); margin: 0 0 14px; }
.modal-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-start; margin-top: 22px; padding-top: 18px; border-top: 2px dashed var(--gold-3); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(14px) scale(.98); opacity: 0; } }

.profile { text-align: center; }
.profile h3 { font-size: 1.7rem; margin: 10px 0 8px; }
.chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.chip { background: var(--beige-2); border: 1px solid var(--beige-3); color: var(--green); border-radius: 999px; padding: 3px 16px; font-weight: 800; font-size: .88rem; }
.sec-title { display: flex; align-items: center; gap: 8px; margin: 24px 0 12px; padding-bottom: 8px; border-bottom: 1.5px solid var(--gold-3); font: 700 1.25rem var(--font-head); color: var(--green); }
.sec-title svg { color: var(--gold); }
.boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.box { background: rgba(255,255,255,.45); border: 1px solid var(--gold-3); border-radius: 12px; padding: 12px 16px; }
.box h4 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding-bottom: 8px; border-bottom: 1px dashed var(--gold-3); font: 700 1.05rem var(--font-head); color: var(--green); }
.box h4 svg { color: var(--gold); width: 16px; height: 16px; }
.box dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.box dt { color: var(--brown); font-size: .92rem; }
.box dd { margin: 0; font-weight: 800; text-align: end; }
.timeline { list-style: none; margin: 0; padding: 0 22px 0 0; border-inline-start: 2px solid var(--green-3); }
.timeline li { position: relative; padding: 0 0 16px; }
.timeline li::before { content: ""; position: absolute; inset-inline-start: -30px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold-3); border: 2.5px solid var(--green); }
.timeline .y { color: var(--gold); font-weight: 800; }
.timeline .t { font-weight: 800; color: var(--green); }
.bio { font-size: 1.1rem; line-height: 2; white-space: pre-wrap; margin: 0; }
.kids { display: flex; flex-wrap: wrap; gap: 6px; }
.kids button { border: 1px solid var(--gold-3); background: rgba(255,255,255,.6); border-radius: 999px; padding: 3px 14px; font: 700 .95rem var(--font-body); color: var(--green); cursor: pointer; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 260; background: var(--green); color: var(--gold-3); border: 1px solid var(--gold); padding: 10px 22px; border-radius: 999px; box-shadow: var(--shadow-lg); font-weight: 800; }
.wa-fab { position: fixed; bottom: 22px; left: 22px; z-index: 110; width: 58px; height: 58px; border-radius: 50%; background: #25d366; color: #fff; display: grid; place-items: center; border: 3px solid #fff; box-shadow: var(--shadow-lg); cursor: pointer; }
.wa-fab svg { width: 30px; height: 30px; }

/* ---------- lock screen ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--dark); position: relative; overflow: hidden; }
.gate svg.scene { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .55; }
.gate { background: var(--dark) url(/hero-sm.webp) center/cover no-repeat; }
@media (min-width: 761px) { .gate { background-image: url(/hero.webp); } }
.gate::before { content: ""; position: fixed; inset: 0; background: rgba(15,25,18,.45); }
.gate .modal-box { position: relative; text-align: center; width: min(420px, 100%); }
.gate .emblem { width: 84px; height: 84px; margin: 0 auto 6px; }

/* ---------- plain pages (admin, join) ---------- */
.wrap { max-width: 760px; margin: 0 auto; padding: 28px 16px 70px; }
.card { background: linear-gradient(180deg, #fbf5e8, #f3e8d0); border: 1.5px solid var(--gold-3); border-radius: 18px; box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 16px; }
.card h2, .card h3 { margin-top: 0; }
.muted { color: var(--brown); }
.center { text-align: center; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; overflow-x: auto; }
.tabs button { border: 1.5px solid var(--gold); background: #fff; padding: 8px 18px; border-radius: 999px; cursor: pointer; font: 800 1rem var(--font-body); color: var(--green); white-space: nowrap; }
.tabs button.on { background: var(--green); color: var(--gold-3); border-color: var(--green); }
.badge { background: var(--danger); color: #fff; border-radius: 999px; padding: 0 7px; font-size: .75rem; margin-inline-start: 6px; }
.sub-person { display: flex; gap: 12px; align-items: center; border-inline-start: 4px solid var(--gold); padding: 10px 12px; background: rgba(255,255,255,.55); border-radius: 10px; margin-top: 10px; }
.sub-person.child { margin-inline-start: 26px; border-color: var(--green-3); }
.sub-person .av { margin: 0; flex: none; }
.link-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px dashed var(--gold-3); }
.link-row:last-child { border-bottom: 0; }
.link-row .lbl { flex: 1; min-width: 180px; }
code.url { direction: ltr; display: block; font-size: .82rem; background: rgba(255,255,255,.7); padding: 6px 8px; border-radius: 6px; word-break: break-all; margin-top: 4px; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg label { flex: 1; min-width: 140px; margin: 0; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: block; text-align: center; padding: 10px; border-radius: 10px; border: 1.5px solid var(--gold); background: #fff; cursor: pointer; font-weight: 800; color: var(--green); }
.seg input:checked + span { background: var(--green); color: var(--gold-3); border-color: var(--green); }
.seg input:focus-visible + span { outline: 2px solid var(--gold); }
.child-row { display: grid; grid-template-columns: 1fr 110px 110px 44px; gap: 8px; margin-top: 8px; align-items: center; }
.icon-x { width: 40px; height: 40px; border-radius: 10px; border: 1px solid #e3b5ab; background: #fff; color: var(--danger); cursor: pointer; font-size: 1.1rem; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .chrome-inner { padding: 10px 14px; }
  .brand b { font-size: 1.25rem; }
  .edit-toggle .lbl { display: none; }
  .grid2, .boxes { grid-template-columns: 1fr; }
  .modal-box { padding: 22px 16px 18px; border-radius: 18px; }
  .tree-toolbar, .tree-footer { padding: 12px; }
  .tree-stage { height: 64vh; }
  .child-row { grid-template-columns: 1fr 1fr 44px; }
  .child-row .cn { grid-column: 1 / -1; }
  .section { padding: 30px 12px 50px; }
}
.chrome .btn.ghost { color: var(--gold-3); border-color: var(--gold); }
.chrome .btn.ghost:hover { background: rgba(232,201,106,.12); }
.chrome .btn { box-shadow: none; }
.chrome .btn:not(.ghost) { background: var(--gold); border-color: var(--gold); color: var(--dark); }
