:root {
  --peach-light: #FBE7CC;
  --peach-mid: #F0C594;
  --peach-deep: #E2A467;
  --brown-dark: #4E2F1D;
  --brown-mid: #7A4A2B;
  --gold: #B9832F;
  --cream: #FFF8EE;
}
* { box-sizing: border-box; }
body { margin:0; font-family:'Work Sans', sans-serif; color:var(--brown-dark); min-height:100vh; background:var(--peach-light); }
.font-serif { font-family:'Fraunces', serif; }
a { color: inherit; }
.app-shell { width:100%; min-height:100vh; margin:0; position:relative; z-index:1; }

.bg-silhouette { position:fixed; right:-4%; bottom:0; width:56vw; max-width:760px; height:auto; color:#B08862; opacity:.15; z-index:0; pointer-events:none; }
.gonjong-header { position:relative; overflow:hidden; border-radius:0 0 24px 24px; background:linear-gradient(160deg, var(--brown-dark), var(--brown-mid)); padding:20px 24px; color:var(--cream); }
.gonjong-header svg { position:absolute; top:0; left:0; width:100%; height:24px; opacity:.3; }
.gonjong-header .inner { position:relative; z-index:1; }
.layout { display:flex; align-items:flex-start; gap:0; }
.sidebar { width:230px; flex-shrink:0; background:var(--cream); border-right:1px solid var(--peach-mid); border-radius:0 0 0 24px; padding:18px 12px; min-height:70vh; }
.side-group { margin-bottom:18px; }
.side-title { margin:0 0 6px; padding:0 8px; font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--gold); }
.side-link { display:block; padding:8px 10px; border-radius:8px; font-size:13px; color:var(--brown-mid); text-decoration:none; margin-bottom:2px; }
.side-link:hover { background:#F5E3CB; }
.side-link.active { background:var(--peach-mid); color:var(--brown-dark); font-weight:600; }
.panel-body { flex:1; min-width:0; min-height:70vh; background:var(--cream); border-radius:0 0 24px 0; padding:16px; }
@media (max-width:760px){ .layout{flex-direction:column} .sidebar{width:100%;border-right:0;border-bottom:1px solid var(--peach-mid);border-radius:0;min-height:0} .panel-body{border-radius:0 0 24px 24px} }

.card { background:var(--cream); border:1px solid var(--peach-mid); border-radius:16px; padding:18px; box-shadow:0 1px 3px rgba(0,0,0,.06); margin-bottom:16px; }
.btn-primary { background:var(--brown-dark); color:#fff; border:none; padding:9px 16px; border-radius:12px; font-size:14px; font-weight:500; cursor:pointer; text-decoration:none; display:inline-block; }
.btn-primary:disabled { background:#C9B8A5; }
.btn-ghost { background:transparent; border:1px solid var(--peach-deep); color:var(--brown-mid); padding:5px 10px; border-radius:8px; font-size:12px; cursor:pointer; text-decoration:none; display:inline-block; }
.btn-ghost:hover { background:#F5E3CB; }
.btn-ghost.danger { color:#b91c1c; }

.field { display:block; margin-bottom:12px; }
.field > span:first-child, .field label { display:block; font-size:12px; font-weight:600; color:var(--brown-mid); margin-bottom:4px; }
.field input, .field select { width:100%; padding:8px 10px; border-radius:8px; border:1px solid var(--peach-deep); font-size:14px; background:#fff; }
.field .hint { display:block; font-size:11px; color:#78716c; margin-top:3px; }

.badge { display:inline-block; padding:2px 10px; border-radius:999px; font-size:11px; font-weight:500; }
.badge-aktif { background:#DDEFD8; color:#2F6B3A; }
.badge-pasif { background:#F6E3B4; color:#8A6110; }
.badge-terkunci { background:#F3D3D0; color:#9B3226; }
.badge-peach { background:var(--peach-mid); color:var(--brown-dark); }

.tabs { display:flex; gap:4px; margin-bottom:16px; flex-wrap:wrap; border-bottom:1px solid var(--peach-mid); }
.tab-btn { padding:8px 16px; border-radius:12px 12px 0 0; font-size:14px; font-weight:500; border:none; background:transparent; color:var(--brown-mid); text-decoration:none; display:inline-block; }
.tab-btn.active { background:var(--peach-mid); color:var(--brown-dark); font-weight:600; }

.chart-scroll { overflow:auto; max-height:75vh; padding:24px 16px 32px; overscroll-behavior:contain; }
.chart, .chart ul { display:flex; align-items:flex-start; list-style:none; margin:0; padding:0; }
/* Lebar isi + margin auto, bukan justify-content:center. Dengan center, bagan yang
   lebih lebar dari layar meluber ke kiri dan sisi kiri itu tidak bisa dijangkau scroll. */
.chart-scroll > .chart { width:max-content; margin:0 auto; position:relative; }
/* Tiap simpul: kepala (kartu + pasangan) di tengah, kelompok anak di bawahnya. */
.chart li { display:flex; flex-direction:column; align-items:center; padding:0 10px; }
.node-head { display:flex; align-items:flex-start; position:relative; z-index:1; }
.node-groups { display:flex; align-items:flex-start; justify-content:center; gap:20px; }
.couple-line { width:20px; height:2px; background:var(--gold); margin-top:24px; flex-shrink:0; }
/* Garis penghubung digambar assets/tree.js di atas lapisan SVG ini. */
.tree-lines { position:absolute; left:0; top:0; pointer-events:none; overflow:visible; z-index:0; }
.tree-lines path { fill:none; stroke:var(--gold); stroke-width:2; }
.member-card { border-radius:12px; border:2px solid var(--peach-deep); padding:10px; background:#fff; box-shadow:0 1px 2px rgba(0,0,0,.05); width:170px; box-sizing:border-box; }
.member-card.male { border-color:#8FB2D6; }
.node-actions { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; justify-content:center; }
.spouse-chip { border-radius:12px; border:1px solid var(--peach-mid); padding:10px; background:#fff; display:flex; flex-direction:column; align-items:flex-start; gap:2px; font-size:12px; color:var(--brown-mid); width:170px; box-sizing:border-box; }

.photo-box { width:40px; height:48px; border-radius:6px; overflow:hidden; background:#f5f5f4; border:1px solid var(--peach-mid); flex-shrink:0; display:flex; align-items:center; justify-content:center; font-size:9px; color:#d6d3d1; }
.photo-box img { width:100%; height:100%; object-fit:cover; }
a.photo-box { text-decoration:none; }

.lightbox-overlay { display:none; position:fixed; inset:0; background:rgba(0,0,0,.82); align-items:center; justify-content:center; z-index:200; padding:24px; }
.lightbox-overlay:target { display:flex; }
.lightbox-overlay img { max-width:90vw; max-height:88vh; border-radius:10px; box-shadow:0 8px 30px rgba(0,0,0,.4); }
.lightbox-close { position:absolute; top:18px; right:24px; color:#fff; font-size:36px; line-height:1; text-decoration:none; font-weight:300; }
.lightbox-close:hover { color:var(--peach-light); }
.gender-icon { display:inline-flex; align-items:center; justify-content:center; width:18px; height:18px; border-radius:999px; font-size:10px; font-weight:700; flex-shrink:0; }
.gender-icon.P { background:#E8AFC4; color:#7A2547; }
.gender-icon.L { background:#A9C6E0; color:#254B7A; }

.toast { font-size:12px; padding:8px 12px; border-radius:10px; background:var(--peach-light); color:var(--brown-dark); margin-bottom:16px; }
.error-text { font-size:12px; color:#b91c1c; margin-bottom:8px; }
table.list { width:100%; border-collapse:collapse; font-size:13px; }
table.list th, table.list td { text-align:left; padding:6px 8px; border-bottom:1px solid var(--peach-mid); }

@media print {
  .chart-scroll { overflow:visible !important; max-height:none !important; }
  .no-print { display:none !important; }
  .node-actions { display:none !important; }
}
