/* GiaPhaCMS V2 — Lớp làm giàu bám sát 6 mockup polish (bổ sung trên reference.css).
   Chỉ chứa những chi tiết mockup có mà reference.css tối giản chưa phủ. */

/* ── Masthead: brand trái + ô tìm + CTA "Mở cây gia phả" phải ── */
.masthead.has-actions .container { justify-content: space-between; text-align: left; }
.masthead-actions { display: flex; align-items: center; gap: 14px; }
.masthead-search {
  display: flex; align-items: center; gap: 10px;
  background: #fffdf7; border-radius: 999px; padding: 10px 18px;
  min-width: 240px; box-shadow: inset 0 1px 3px rgba(64,20,22,.12);
}
.masthead-search img { width: 18px; opacity: .6; }
.masthead-search input {
  border: 0; outline: 0; background: transparent; width: 100%;
  font-size: 14px; color: #3a2a24; font-family: inherit;
}
.masthead-search input::placeholder { color: #9b8778; }
.masthead-cta {
  display: inline-flex; align-items: center; gap: 9px; white-space: nowrap;
  background: #5c0f0f; color: #ffe8a8; border: 1px solid #d4a72c;
  border-radius: 12px; padding: 12px 20px; font-weight: 600; font-size: 14px;
  box-shadow: 0 6px 18px rgba(62,10,16,.3);
}
.masthead-cta:hover { background: #470b0b; }
.masthead-cta img { width: 18px; filter: brightness(0) saturate(100%) invert(78%) sepia(38%) saturate(560%) hue-rotate(357deg) brightness(103%) contrast(96%); }
@media (max-width: 1180px) { .masthead-search { min-width: 160px; } }

/* ── Home: stats có icon ── */
.stats-strip .stat.has-icon { display: flex; align-items: center; gap: 14px; text-align: left; }
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px; flex: 0 0 auto;
  background: rgba(214,167,44,.16); display: grid; place-items: center;
}
.stat-icon img { width: 24px; filter: brightness(0) saturate(100%) invert(72%) sepia(51%) saturate(432%) hue-rotate(357deg) brightness(92%) contrast(88%); }

/* ── Home: danh sách chi họ nổi bật dạng thẻ giàu ── */
.branch-list.rich { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.branch-list.rich .branch-item {
  display: flex; align-items: center; gap: 14px; text-decoration: none;
  padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px;
  background: #fffdf7; transition: border-color .15s, box-shadow .15s;
}
.branch-list.rich .branch-item:hover { border-color: var(--gold); box-shadow: var(--shadow-sm); }
.branch-ico {
  width: 44px; height: 44px; border-radius: 10px; flex: 0 0 auto;
  background: rgba(150,31,34,.08); display: grid; place-items: center;
}
.branch-ico img { width: 24px; filter: brightness(0) saturate(100%) invert(15%) sepia(58%) saturate(2200%) hue-rotate(335deg) brightness(85%) contrast(92%); }
.branch-text { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.branch-text strong { font: 700 15px/1.35 'Lora', serif; color: #751722; }
.branch-text small { color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.branch-chev { width: 16px; opacity: .45; }

/* ── Home: thông báo giàu ── */
.notice-list.rich { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.notice-list.rich .notice-item { display: flex; gap: 13px; align-items: flex-start; }
.notice-ico { width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto; background: rgba(150,31,34,.08); display: grid; place-items: center; }
.notice-ico img { width: 20px; filter: brightness(0) saturate(100%) invert(15%) sepia(58%) saturate(2200%) hue-rotate(335deg) brightness(85%) contrast(92%); }
.notice-body strong { display: block; font: 600 14.5px/1.4 'Be Vietnam Pro', sans-serif; color: #3a2a24; }
.notice-body p { margin: 4px 0 5px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.notice-body small { color: #9a8778; font-size: 12px; }
.notice-all { display: inline-block; margin-top: 14px; color: var(--red); font-weight: 600; font-size: 13.5px; text-decoration: none; }

/* ── Home: gallery ảnh thật ── */
.gallery-grid.photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.gallery-photo {
  position: relative; aspect-ratio: 3/4; border-radius: 12px; overflow: hidden;
  background-size: cover; background-position: center; border: 1px solid var(--line);
}
.gallery-photo figcaption {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 10px 9px;
  color: #fff; font-size: 12px; font-weight: 500;
  background: linear-gradient(transparent, rgba(50,15,15,.82));
}
@media (max-width: 767px) { .gallery-grid.photos { grid-template-columns: 1fr 1fr; } }

/* ── Cây: icon trong node + chevron mở/thu + legend mới ── */
.tree-node { padding-top: 30px; }
.node-ico {
  position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
  width: 34px; height: 34px; border-radius: 50%; background: #fffaf0;
  border: 2px solid #d6ba6b; display: grid; place-items: center; z-index: 2;
}
.node-ico img { width: 18px; filter: brightness(0) saturate(100%) invert(20%) sepia(45%) saturate(1600%) hue-rotate(335deg) brightness(80%) contrast(90%); }
.tree-node.root .node-ico { background: #7f1722; border-color: #e5c05c; }
.tree-node.root .node-ico img { filter: brightness(0) saturate(100%) invert(85%) sepia(30%) saturate(600%) hue-rotate(357deg) brightness(103%) contrast(95%); }
/* chevron thu/mở thay cho vòng tròn +/− */
.node-toggle {
  background: transparent; border: 0; box-shadow: none; color: #b58a2e;
  width: 22px; height: 18px; bottom: -9px; font-size: 13px; line-height: 1;
}
.tree-node.root .node-toggle { color: #f0cf7b; }
.legend-ico {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: rgba(214,167,44,.16); border: 1px solid var(--line);
}
.legend-ico.ancestor { background: rgba(150,31,34,.1); }
.legend-ico img { width: 17px; filter: brightness(0) saturate(100%) invert(20%) sepia(45%) saturate(1600%) hue-rotate(335deg) brightness(80%) contrast(90%); }
.legend-dot.match { border-color: var(--gold); outline: 2px solid var(--gold); outline-offset: 1px; }
.legend-tip strong { color: #751722; }

/* ── Hồ sơ: sơ đồ quan hệ trực hệ ── */
.rel-diagram { display: flex; flex-direction: column; align-items: center; gap: 0; }
.rel-slot { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.rel-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.rel-node {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  background: #fffdf7; border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 16px; min-width: 210px; justify-content: center;
}
.rel-node:hover { border-color: var(--gold); }
.rel-node.muted { background: #f9f4ea; }
.rel-node strong { font: 600 14px/1.3 'Be Vietnam Pro', sans-serif; color: #3a2a24; display: block; }
.rel-node small { color: var(--muted); font-size: 12px; }
.rel-ico { width: 30px; height: 30px; border-radius: 50%; background: rgba(150,31,34,.08); display: grid; place-items: center; flex: 0 0 auto; }
.rel-ico img { width: 16px; filter: brightness(0) saturate(100%) invert(20%) sepia(45%) saturate(1600%) hue-rotate(335deg) brightness(80%) contrast(90%); }
.rel-connect { width: 2px; height: 22px; background: #c39337; }
.rel-children { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.rel-child {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none;
  background: #fffdf7; border: 1px solid var(--line); border-radius: 12px; padding: 12px 10px;
  width: 118px; text-align: center;
}
.rel-child:hover { border-color: var(--gold); }
.rel-child strong { font: 600 12.5px/1.25 'Be Vietnam Pro', sans-serif; color: #3a2a24; }
.rel-child small { color: var(--muted); font-size: 11px; }

/* ── Hồ sơ: chip thống kê hậu duệ + số con dưới node ── */
.descendant-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-bottom: 26px; }
.dstat {
  display: inline-flex; align-items: center; gap: 9px; white-space: nowrap;
  background: #fffdf7; border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-size: 13px; color: #4a3a33; font-weight: 500;
}
.dstat img { width: 18px; height: 18px; flex: 0 0 auto; object-fit: contain; opacity: .8; }
.node-sub { display: block; margin-top: 6px; font-size: 11px; color: #97672a; }

/* ── Hồ sơ: stepper ngang "Vị trí phả hệ" ── */
.lineage-stepper { display: flex; align-items: flex-start; justify-content: center; flex-wrap: wrap; gap: 4px; }
.lstep { display: flex; flex-direction: column; align-items: center; gap: 6px; text-decoration: none; width: 120px; text-align: center; }
.lstep-num {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: #f3e6bb; color: #75480c; font: 700 17px 'Lora', serif; border: 2px solid #e2cf90;
}
.lstep.active .lstep-num { background: #971f2b; color: #ffe8a8; border-color: #e5c05c; }
.lstep-name { font: 600 13px/1.25 'Be Vietnam Pro', sans-serif; color: #3a2a24; }
.lstep-gen { font-size: 11px; color: var(--muted); }
.lstep-arrow { color: #c39337; font-size: 20px; align-self: center; margin-top: 10px; }
@media (max-width: 767px) { .lstep-arrow { display: none; } .lineage-stepper { gap: 14px; } }

/* ── Chi họ: biểu đồ donut thống kê nhánh ── */
.donut-row { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut {
  width: 132px; height: 132px; border-radius: 50%; position: relative; flex: 0 0 auto;
}
.donut-hole {
  position: absolute; inset: 22px; background: #fffdf7; border-radius: 50%;
  display: grid; place-items: center; text-align: center;
}
.donut-hole strong { font: 700 26px 'Lora', serif; color: #751722; line-height: 1; }
.donut-hole span { font-size: 11px; color: var(--muted); }
.donut-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.donut-legend li { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #4a3a33; }
.donut-legend i { width: 14px; height: 14px; border-radius: 4px; flex: 0 0 auto; }

/* ── Tìm quan hệ: nhãn nối + phối ngẫu + khám phá tiếp ── */
.path-node { display: flex; align-items: center; gap: 14px; }
.path-main { flex: 1; }
.path-spouse { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.path-spouse img { width: 16px; opacity: .6; }
.path-line { position: relative; }
.path-edge-label {
  position: absolute; left: calc(50% + 14px); top: 50%; transform: translateY(-50%);
  background: #fdf1d6; color: #97672a; font-size: 11px; padding: 2px 10px;
  border-radius: 999px; white-space: nowrap; border: 1px solid #ecd9a2;
}
.explore-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.explore-list a {
  display: flex; align-items: center; gap: 12px; text-decoration: none;
  padding: 13px 16px; border: 1px solid var(--line); border-radius: 12px; background: #fffdf7;
  color: #3a2a24; font-weight: 500; font-size: 14px;
}
.explore-list a:hover { border-color: var(--gold); }
.explore-list img { width: 19px; opacity: .7; }
.explore-chev { margin-left: auto; color: #b58a2e; font-size: 18px; }

/* ═══════════════════════════════════════════════════════════
   HEADER SÁNG (KEM) theo mockup — ghi đè nền rượu của reference.css
   Masthead + main-nav dùng nền kem/parchment, chữ đỏ sẫm.
   ═══════════════════════════════════════════════════════════ */
.masthead {
  height: 138px;
  background: #fdfaf1;
  color: #4a2b23;
  border-bottom: 1px solid #ecdfc4;
}
.masthead::before {
  background: url('../../v2/assets/ornaments/cloud-left.svg') left -10px top -6px/220px no-repeat,
              url('../../v2/assets/ornaments/cloud-right.svg') right -10px top -6px/220px no-repeat;
  opacity: .5;
}
.brand-title { color: #8c1c22; letter-spacing: .06em; text-transform: uppercase; font-size: 27px; }
.brand-subtitle {
  color: #6a4a3a; display: flex; align-items: center; gap: 12px; margin-top: 9px;
}
.brand-subtitle::before, .brand-subtitle::after {
  content: ''; height: 1px; width: 64px; flex: 0 0 auto;
  background: linear-gradient(90deg, transparent, #c9a24a, transparent);
}

.main-nav {
  background: #fffdf7; color: #5a3a30;
  box-shadow: 0 2px 10px rgba(90,40,20,.06);
  border-bottom: 1px solid #ecdfc4;
}
.main-nav .nav-link { color: #5a3a30; border-bottom-color: transparent; text-transform: uppercase; letter-spacing: .04em; }
.v2-mobile-nav a { text-transform: uppercase; letter-spacing: .04em; }
.main-nav .nav-link:hover { background: rgba(140,28,34,.05); border-bottom-color: #d4a72c; color: #8c1c22; }
.main-nav .nav-link.is-active { background: transparent; color: #8c1c22; border-bottom-color: #8c1c22; font-weight: 700; }
/* ô tìm trong nav bị lặp với masthead → ẩn để giống mockup */
.main-nav .header-search { display: none; }
.main-nav .container { justify-content: center; }
.main-nav .nav-list { gap: 10px; }

/* ═══════════════════════════════════════════════════════════
   HERO trang chủ bám mockup: rồng+mặt trời, CTA có icon,
   thanh stats trên nền đỏ với vạch vàng + khung góc.
   ═══════════════════════════════════════════════════════════ */
.brand-hero .hero-ornament {
  position: absolute; top: 22px; left: 6%; width: 54%; aspect-ratio: 1200/420;
  background: url('../../v2/assets/ornaments/dragon-sun-master.svg') center top/contain no-repeat;
  opacity: .4; z-index: 1; pointer-events: none;
}
/* icon trong nút CTA */
.btn .btn-ico { width: 18px; height: 18px; }
.btn-primary .btn-ico { filter: brightness(0) saturate(100%) invert(9%) sepia(48%) saturate(3200%) hue-rotate(337deg) brightness(70%) contrast(95%); }
.btn-secondary .btn-ico { filter: brightness(0) invert(1); opacity: .92; }

/* Thanh stats kiểu mockup: nền đỏ trong suốt + khung vàng + vạch ngăn */
.brand-hero .stats-strip {
  gap: 0; padding: 6px 10px; border-radius: 16px;
  background: rgba(74,15,20,.42);
  border: 1px solid rgba(214,167,44,.5);
  box-shadow: inset 0 0 0 1px rgba(255,240,190,.06);
}
.brand-hero .stats-strip::before, .brand-hero .stats-strip::after {
  content: ''; position: absolute; width: 34px; height: 34px;
  background: url('../../v2/assets/ornaments/corner-frame.svg') center/contain no-repeat;
}
.brand-hero .stats-strip::before { top: 6px; left: 6px; }
.brand-hero .stats-strip::after  { bottom: 6px; right: 6px; transform: rotate(180deg); }
.brand-hero .stat {
  background: transparent; border: 0; box-shadow: none; border-radius: 0;
  min-height: 78px; color: #fff7df; padding: 14px 20px;
  border-right: 1px solid rgba(214,167,44,.32);
}
.brand-hero .stats-strip .stat:last-child { border-right: 0; }
.brand-hero .stat.has-icon { gap: 12px; }
.brand-hero .stat-icon { background: transparent; width: 34px; height: 34px; border-radius: 0; }
.brand-hero .stat-icon img { width: 30px; }
.brand-hero .stat-value { color: #f6d98a; font-size: 30px; }
.brand-hero .stat-label { color: #fbe9c4; font-size: 12.5px; }
@media (max-width: 767px) {
  .brand-hero .stat { border-right: 0; border-bottom: 1px solid rgba(214,167,44,.28); }
  .brand-hero .hero-ornament { width: 80%; opacity: .3; }
}

/* Hero ảnh full-bleed + gradient đỏ bên trái ở MỌI bề rộng (mockup):
   reference chỉ làm vậy ở ≤1279px, ≥1280 để ảnh trong luồng gây vỡ layout. */
.brand-hero .hero-media { position: absolute; inset: 0; }
.brand-hero .hero-media::after {
  background:
    linear-gradient(90deg, rgba(96,18,26,.97) 28%, rgba(96,18,26,.58) 54%, rgba(96,18,26,.12) 100%),
    linear-gradient(0deg, rgba(65,12,17,.55), transparent 46%);
}
.brand-hero .hero-copy { position: relative; z-index: 2; }

/* ═══════════════════════════════════════════════════════════
   CÁC SECTION DƯỚI TRANG CHỦ bám mockup
   ═══════════════════════════════════════════════════════════ */
/* Truy cập nhanh: icon ĐỎ trên nền đỏ nhạt + mũi tên đỏ cuối thẻ */
.icon-tile { background: rgba(150,31,34,.09); }
.quick-card .icon-tile img {
  filter: brightness(0) saturate(100%) invert(15%) sepia(58%) saturate(2600%) hue-rotate(335deg) brightness(86%) contrast(92%);
}
.quick-card { position: relative; padding-bottom: 46px; }
.quick-card p { line-height: 1.55; }
.quick-arrow { position: absolute; left: 26px; bottom: 20px; }
.quick-arrow img {
  width: 22px;
  filter: brightness(0) saturate(100%) invert(15%) sepia(58%) saturate(2600%) hue-rotate(335deg) brightness(86%) contrast(92%);
}

/* Phả ký: ảnh minh hoạ trái + chữ phải, đoạn mở đầu đậm */
.phaky-grid { display: grid; grid-template-columns: 210px 1fr; gap: 24px; align-items: stretch; }
.phaky-illust {
  border: 1px solid var(--line); border-radius: 12px; background: #f6eed9;
  padding: 14px; display: grid; place-items: center; min-height: 210px;
}
.phaky-illust img { width: 100%; height: 100%; object-fit: contain; }
.phaky-intro { font-weight: 700; color: #3a2a24; font-size: 15px; line-height: 1.55; margin: 0 0 12px; }
.phaky-text p { color: var(--muted); font-size: 14px; line-height: 1.65; margin: 0 0 12px; }
.phaky-text .btn { margin-top: 4px; }
.btn-outline .btn-ico { filter: brightness(0) saturate(100%) invert(15%) sepia(58%) saturate(2600%) hue-rotate(335deg) brightness(86%) contrast(92%); }
@media (max-width: 767px) { .phaky-grid { grid-template-columns: 1fr; } .phaky-illust { min-height: 160px; } }

/* Hình ảnh dòng họ: chú thích DƯỚI ảnh (không phủ) */
.gallery-grid.photos { grid-template-columns: repeat(4, 1fr); gap: 14px; }
.gallery-photo { display: flex; flex-direction: column; gap: 8px; aspect-ratio: auto; border: 0; overflow: visible; border-radius: 0; background: none; }
.gallery-img { display: block; aspect-ratio: 4/3; border-radius: 12px; background-size: cover; background-position: center; border: 1px solid var(--line); }
.gallery-photo figcaption {
  position: static; inset: auto; background: none; color: var(--muted);
  font-size: 12.5px; text-align: center; padding: 0; font-weight: 500;
}
@media (max-width: 767px) { .gallery-grid.photos { grid-template-columns: 1fr 1fr; } }

/* ═══════════ Slide ảnh dòng họ (tự chạy) ═══════════ */
/* Thẻ "Hình ảnh dòng họ" cao bằng cột Thông báo, slide căn giữa theo chiều dọc */
.home-media-row { align-items: stretch; }
.home-images-card { display: flex; flex-direction: column; }
.home-images-card .fam-slider { margin-block: auto; width: 100%; }
.fam-slider { position: relative; --per: 4; }
.fam-viewport { overflow: hidden; border-radius: 14px; }
.fam-track { display: flex; transition: transform .6s cubic-bezier(.4, 0, .2, 1); will-change: transform; }
.fam-slide { flex: 0 0 calc(100% / var(--per, 4)); box-sizing: border-box; min-width: 0; padding: 0 6px; display: flex; flex-direction: column; }
.fam-frame {
  position: relative; margin: 0; border-radius: 12px; overflow: hidden;
  aspect-ratio: 4 / 5; border: 1px solid var(--line);
  box-shadow: 0 6px 16px rgba(90, 40, 20, .10); background: #f3ead9;
}
.fam-frame img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .6s ease; }
.fam-frame:hover img { transform: scale(1.04); }
/* Kích thước ảnh (tỉ lệ khung) do admin chọn */
.fam-slider.size-small  .fam-frame { aspect-ratio: 1 / 1; }
.fam-slider.size-medium .fam-frame { aspect-ratio: 4 / 5; }
.fam-slider.size-large  .fam-frame { aspect-ratio: 3 / 4; }
.fam-cap {
  margin-top: 9px; text-align: center; color: var(--muted);
  font-size: 12.5px; font-weight: 500; line-height: 1.35;
}
.fam-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(255, 253, 247, .94); color: #8c1c22; font-size: 24px; line-height: 1;
  cursor: pointer; display: grid; place-items: center; box-shadow: 0 4px 14px rgba(90, 40, 20, .18);
  transition: background .15s, transform .15s;
}
.fam-nav:hover { background: #8c1c22; color: #fff; }
.fam-nav.prev { left: 10px; } .fam-nav.next { right: 10px; }
.fam-dots { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.fam-dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; background: #d8cdb5; cursor: pointer; transition: all .2s; }
.fam-dot.active { width: 22px; background: #8c1c22; }
/* Khi số ảnh ≤ số cột hiển thị: tắt điều khiển, canh giữa */
.fam-slider.is-static .fam-nav, .fam-slider.is-static .fam-dots { display: none; }
.fam-slider.is-static .fam-track { justify-content: center; }
@media (max-width: 1023px) { .fam-slider { --per: 2; } }
@media (max-width: 639px)  { .fam-slider { --per: 1; } .fam-nav { width: 36px; height: 36px; font-size: 20px; } }

/* ═══════════ Tìm quan hệ (V2) ═══════════ */
.hero-subline { margin-top: 6px; font-size: 14px; color: #f4d8ab; opacity: .92; }
.rel-picker { padding: 26px 28px; }
.rel-picker-grid { display: grid; grid-template-columns: 1fr auto 1fr; gap: 18px; align-items: center; margin-top: 6px; }
.rel-person { border: 1px solid var(--line); border-radius: 16px; padding: 18px; background: #fffdf7; }
.rel-person-label { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 12px; }
.rel-person-head { display: flex; align-items: center; gap: 14px; min-height: 58px; }
.rel-avatar { width: 56px; height: 56px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  background: #f3e2b3; color: #7a1420; font: 700 18px/1 'Lora', serif; border: 2px solid #e6c877; }
.rel-person-info { min-width: 0; }
.rel-name { display: block; font: 700 17px/1.25 'Lora', serif; color: #3a2318; }
.rel-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 7px; }
.rel-chip { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 10px; border-radius: 999px;
  background: #f6ead2; color: #7a5a1e; font-size: 11.5px; font-weight: 700; }
.rel-search-box { position: relative; margin-top: 14px; }
.rel-search-box > img { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; opacity: .5; }
.rel-search { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 10px 36px; font-size: 13.5px; font-family: inherit; background: #fff; }
.rel-search:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.rel-results { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 12px 30px rgba(70,25,15,.18); max-height: 280px; overflow: auto; padding: 6px; }
.rel-result-item { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: 0; cursor: pointer;
  padding: 8px 10px; border-radius: 9px; text-align: left; font-family: inherit; }
.rel-result-item:hover { background: #f7efdd; }
.rel-result-mono { width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  background: #f3e2b3; color: #7a1420; font: 700 13px/1 'Lora', serif; }
.rel-result-txt strong { display: block; font-size: 13.5px; color: #3a2318; }
.rel-result-txt small { color: var(--muted); font-size: 11.5px; }
.rel-result-empty { padding: 12px; color: var(--muted); font-size: 13px; text-align: center; }
.rel-swap { width: 48px; height: 48px; border-radius: 50%; border: 0; cursor: pointer; background: var(--wine, #8c1c22);
  display: grid; place-items: center; box-shadow: 0 6px 16px rgba(90,20,25,.28); }
.rel-swap img { width: 20px; filter: brightness(0) invert(1); }
.rel-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 20px; }
.rel-swaplink { border: 0; background: 0; cursor: pointer; color: var(--muted); font-size: 13px; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px; }
.rel-swaplink img { width: 15px; opacity: .6; }
/* Kết quả */
.rel-result { padding: 26px 28px; }
.rel-headline { font: 700 25px/1.35 'Lora', serif; color: #7a1420; text-align: center; margin: 8px auto 0; max-width: 780px; }
.rel-result-chips { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin: 18px 0; }
.rel-badge { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 6px 16px; border-radius: 999px;
  background: #fbf1da; border: 1px solid #ecd39a; color: #6c4a17; font-size: 13px; font-weight: 700; }
.rel-badge img { width: 16px; opacity: .8; }
.rel-sentence { text-align: center; color: var(--muted); font-size: 14.5px; margin: 0 auto 20px; max-width: 720px; }
.rel-result-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
/* Đường quan hệ */
.rel-path-card { padding: 26px 28px; }
.rel-path { max-width: 760px; margin: 6px auto 0; }
.rel-step { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border: 1px solid var(--line);
  border-radius: 14px; background: #fffdf7; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
.rel-step:hover { border-color: var(--gold); box-shadow: 0 4px 14px rgba(90,40,20,.08); }
.rel-step.is-end { border-color: #b5202b; box-shadow: 0 4px 14px rgba(140,28,34,.12); }
.rel-step-num { width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  background: #f3e2b3; color: #7a1420; font: 700 16px/1 'Lora', serif; border: 2px solid #e6c877; }
.rel-step.is-end .rel-step-num { background: #b5202b; color: #fff; border-color: #b5202b; }
.rel-step-main { flex: 1; min-width: 0; }
.rel-step-main strong { display: block; font: 700 16px/1.3 'Lora', serif; color: #3a2318; }
.rel-step-main small { color: var(--muted); font-size: 12.5px; }
.rel-step-spouse { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.rel-step-spouse img { width: 16px; opacity: .6; }
.rel-step-link { display: flex; align-items: center; gap: 10px; padding: 6px 0 6px 20px; }
.rel-step-arrow { color: #b5202b; font-size: 18px; line-height: 1; }
.rel-step-edge { color: #b5202b; font-size: 12px; font-weight: 700; }
/* Chú giải */
.rel-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.rel-legend li { display: flex; align-items: center; gap: 12px; color: #4a3a33; font-size: 14px; }
.rel-legend img { width: 18px; opacity: .7; }
.rel-legend-arrow, .rel-legend-hash { width: 18px; text-align: center; color: #b5202b; font-weight: 800; }
.rel-bottom { align-items: stretch; }
.rel-info-card { padding: 24px 26px; }
.rel-info-card .section-heading { margin-bottom: 18px; }
@media (max-width: 767px) {
  .rel-picker-grid { grid-template-columns: 1fr; }
  .rel-swap { transform: rotate(90deg); justify-self: center; }
  .rel-step-spouse { display: none; }
}

/* ═══════════ Hồ sơ thành viên (V2) ═══════════ */
.pf-hero { height: auto; }
.pf-hero .container { height: auto; }
.pf-hero-grid { display: grid; grid-template-columns: auto 1fr auto; gap: 30px; align-items: center; padding: 34px 0 40px; position: relative; z-index: 2; }
.pf-avatar { margin: 0; }
.pf-hero-main { min-width: 0; color: #fff6e2; }
.pf-hero-main .breadcrumbs { margin-bottom: 8px; }
.pf-hero-main h1 { font: 700 42px/1.15 'Lora', serif; margin: 4px 0 14px; color: #fff; }
.pf-hero-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.pf-chip { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 14px; border-radius: 999px;
  background: rgba(255,244,205,.16); border: 1px solid rgba(246,213,119,.5); color: #ffeec2; font-size: 13px; font-weight: 700; }
.pf-chip.is-gone { background: rgba(255,255,255,.1); color: #f4d8ab; }
.pf-spouse { margin: 14px 0 0; color: #fbe8c2; font-size: 15px; }
.pf-spouse strong { color: #fff; }
.pf-lineage { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; }
.pf-lineage a { color: #f4d37b; font-weight: 600; }
.pf-lineage a:hover { text-decoration: underline; }
.pf-lineage .pf-sep { color: #d9a86a; }
.pf-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.pf-illustration { height: 200px; }
.pf-illustration img { width: min(100%, 360px); height: 100%; object-fit: contain; }

.pf-split { display: grid; grid-template-columns: minmax(0,5fr) minmax(0,6fr); gap: 24px; align-items: start; }
.pf-card { padding: 26px 28px; }
.pf-card .section-heading { margin-bottom: 20px; }
/* Thông tin phả hệ */
.pf-info { margin: 0; }
.pf-info > div { display: flex; gap: 16px; padding: 11px 0; border-bottom: 1px solid #f0e6d0; }
.pf-info > div:last-child { border-bottom: 0; }
.pf-info dt { flex: 0 0 150px; color: var(--muted); font-size: 14px; margin: 0; }
.pf-info dd { margin: 0; color: #33241d; font-weight: 600; font-size: 14px; }
.pf-info dd.pf-gone { color: #a3242f; }
.pf-note { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; padding: 12px 14px; border-radius: 12px;
  background: #f7efdd; color: #6b551f; font-size: 13px; }
.pf-note img { width: 16px; margin-top: 1px; opacity: .8; }
/* Quan hệ trực hệ */
.pf-rel { max-width: 420px; }
.pf-rel-line { display: flex; flex-direction: column; gap: 6px; }
.pf-rel-tag { font-size: 12px; color: var(--muted); }
.pf-rel-box { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 12px; background: #fffdf7; text-decoration: none; color: inherit; }
.pf-rel-box:hover { border-color: var(--gold); }
.pf-rel-box.muted { background: #f9f4ea; }
.pf-rel-ico { width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; background: rgba(150,31,34,.08); }
.pf-rel-ico img { width: 17px; opacity: .8; }
.pf-rel-txt strong { display: block; font: 600 14.5px/1.3 'Be Vietnam Pro', sans-serif; color: #33241d; }
.pf-rel-txt small { color: var(--muted); font-size: 12px; }
.pf-rel-connect { width: 2px; height: 22px; background: #c39337; margin-left: 17px; }
.pf-rel-kids-head { margin: 20px 0 12px; padding-top: 16px; border-top: 1px solid #f0e6d0; font-size: 13px; color: var(--muted); font-weight: 600; }
.pf-kids { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 10px; }
.pf-kid { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 5px; padding: 14px 8px;
  border: 1px solid var(--line); border-radius: 12px; background: #fffdf7; text-decoration: none; color: inherit; }
.pf-kid:hover { border-color: var(--gold); }
.pf-kid .pf-kid-ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(150,31,34,.08); }
.pf-kid-ico img { width: 17px; opacity: .8; }
.pf-kid strong { font: 600 12.5px/1.25 'Be Vietnam Pro', sans-serif; color: #33241d; }
.pf-kid small { color: var(--muted); font-size: 11px; }
/* Nhánh hậu duệ */
.pf-branch-stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.pf-minitree { display: flex; flex-direction: column; align-items: center; }
.pf-couple { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center; }
.pf-couple-box { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border: 1px solid #d9b24d;
  border-radius: 14px; background: #fff8e6; text-decoration: none; color: inherit; box-shadow: var(--shadow-sm); }
.pf-couple-box.muted { background: #f9f4ea; }
.pf-heart { color: #c0323b; font-size: 22px; }
.pf-branch-children { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; position: relative; margin-top: 22px; padding-top: 22px; }
.pf-branch-children::before { content: ""; position: absolute; top: 0; left: 12%; right: 12%; height: 2px; background: #d1969b; }
.pf-branch-kid { position: relative; width: 180px; display: flex; flex-direction: column; gap: 10px; padding: 14px;
  border: 1px solid var(--line); border-radius: 14px; background: #fffdf7; text-decoration: none; color: inherit; }
.pf-branch-kid:hover { border-color: var(--gold); }
.pf-branch-kid::before { content: ""; position: absolute; top: -22px; left: 50%; width: 2px; height: 22px; background: #d1969b; }
.pf-branch-kid-top { display: flex; align-items: center; gap: 10px; }
.pf-branch-kid-sub { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; padding: 4px 10px; border-radius: 999px;
  background: #f4ead3; color: #7a5a1e; font-size: 11.5px; font-weight: 700; }
.pf-branch-kid-sub img { width: 13px; opacity: .8; }
/* Thanh hành động cuối */
.pf-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.pf-action { flex: 1; min-width: 200px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px 20px; border: 1px solid var(--line); border-radius: 14px; background: #fffdf7; color: #4a3a33;
  font: 600 14px 'Be Vietnam Pro', sans-serif; cursor: pointer; text-decoration: none; }
.pf-action:hover { border-color: var(--gold); background: #fff8e6; }
.pf-action img { width: 17px; opacity: .75; }
@media (max-width: 1023px) {
  .pf-hero-grid { grid-template-columns: auto 1fr; }
  .pf-illustration { display: none; }
  .pf-split { grid-template-columns: 1fr; }
}
@media (max-width: 767px) {
  .pf-hero-grid { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .pf-hero-main h1 { font-size: 32px; }
  .pf-hero-actions, .pf-hero-chips, .pf-lineage { justify-content: center; }
  .pf-action { min-width: 0; flex-basis: 100%; }
}

/* ═══════════ Tra cứu thành viên (V2) ═══════════ */
.sr-hero-sub { color: #f4d37b; font-size: 17px; font-weight: 600; margin: 10px 0 0; }
.sr-filters { display: grid; grid-template-columns: repeat(3, 1fr) auto; gap: 14px; margin-top: 18px; align-items: end; }
.sr-field { display: flex; flex-direction: column; gap: 6px; }
.sr-field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.sr-field .fake-select { width: 100%; appearance: auto; }
.sr-viewtoggle { align-self: end; height: 48px; align-items: center; }
.sr-viewtoggle button { display: inline-flex; align-items: center; gap: 7px; border: 0; background: 0; cursor: pointer;
  font-family: inherit; font-size: 13px; color: #7a5f45; padding: 8px 14px; border-radius: 9px; }
.sr-viewtoggle button img { width: 15px; opacity: .7; }
.sr-viewtoggle button.active { background: #fff; color: #7a1822; font-weight: 700; box-shadow: 0 2px 8px rgba(65,17,19,.1); }
.sr-viewtoggle button.active img { opacity: 1; }
.sr-summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px;
  padding-top: 16px; border-top: 1px solid #efe1bd; font-size: 14px; color: #5a4a40; }
.sr-summary strong { color: #7a1822; }
.sr-clear { display: inline-flex; align-items: center; gap: 7px; color: #a3242f; font-weight: 600; font-size: 13.5px; }
.sr-clear img { width: 16px; }
/* Kết quả */
.sr-results-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.sr-results-head h2 { font: 700 26px/1.2 'Lora', serif; color: #761722; margin: 0; }
.sr-sort { height: 44px; border: 1px solid #d9c58d; border-radius: 11px; padding: 0 14px; background: #fffdf7; color: #5a4a40; font-family: inherit; font-size: 13.5px; cursor: pointer; }
.sr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.sr-grid.is-compact { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.sr-card { padding: 20px 22px; display: flex; flex-direction: column; }
.sr-card-top { display: grid; grid-template-columns: 76px 1fr auto; gap: 16px; align-items: center; }
.sr-avatar { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; align-self: start;
  background: radial-gradient(circle at 50% 40%, #f6e6bd, #efdcab); border: 2px solid #dcbf72; }
.sr-avatar img { width: 34px; opacity: .55; }
.sr-card-body { min-width: 0; }
.sr-card-body h3 { font: 700 20px/1.3 'Lora', serif; color: #7a1420; margin: 0 0 8px; }
.sr-card-body .member-meta { margin: 0 0 8px; }
.sr-spouse { font-size: 13.5px; color: #5a4a40; margin: 0 0 8px; }
.sr-status { font-size: 13.5px; font-weight: 700; }
.sr-status.is-gone { color: #a3242f; }
.sr-status.is-alive { color: #2f7a52; }
.sr-view { align-self: center; white-space: nowrap; padding: 9px 18px; min-height: 40px; }
.sr-lineage { margin-top: 16px; padding-top: 14px; border-top: 1px solid #eadbac; font-size: 12.5px; color: #76675f; line-height: 1.7; }
.sr-lineage .sr-sep { color: #c39337; }
/* Trợ giúp tra cứu */
.sr-help { padding: 26px 28px; }
.sr-tips { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.sr-tip { display: flex; flex-direction: column; gap: 8px; }
.sr-tip-ico { width: 42px; height: 42px; border-radius: 12px; background: #f6df9c; display: grid; place-items: center; }
.sr-tip-ico img { width: 20px; }
.sr-tip strong { font: 600 14.5px/1.35 'Be Vietnam Pro', sans-serif; color: #33241d; }
.sr-tip small { color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.sr-ask p { margin-bottom: 18px; font-size: 14px; }
.sr-ask-btn { align-self: flex-start; }
@media (max-width: 1023px) {
  .sr-filters { grid-template-columns: 1fr 1fr; }
  .sr-viewtoggle { grid-column: 1 / -1; justify-content: center; }
  .sr-grid, .sr-grid.is-compact { grid-template-columns: 1fr; }
  .sr-tips { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 640px) {
  .sr-filters { grid-template-columns: 1fr; }
  .sr-card-top { grid-template-columns: 60px 1fr; }
  .sr-view { grid-column: 1 / -1; align-self: stretch; text-align: center; }
}

/* ═══════════ Chi họ (V2) ═══════════ */
.br-hero { height: auto; }
.br-hero .container { height: auto; }
.br-hero-grid { display: grid; grid-template-columns: 1fr 380px; gap: 34px; align-items: center; padding: 34px 0 40px; position: relative; z-index: 2; }
.br-hero-main { min-width: 0; color: #fff6e2; }
.br-hero-main .breadcrumbs { margin-bottom: 10px; }
.br-hero-main .eyebrow { color: #f4d37b; }
.br-hero-main h1 { font: 700 42px/1.15 'Lora', serif; margin: 6px 0 10px; color: #fff; }
.br-hero-sub { color: #f4d37b; font-size: 15px; font-weight: 600; margin: 0 0 12px; }
.br-couple { display: flex; align-items: center; gap: 8px; color: #fbe8c2; font-size: 15px; margin: 0 0 18px; }
.br-couple strong { color: #fff; }
.br-union { width: 18px; filter: brightness(0) invert(1); opacity: .85; }
.br-stats { display: flex; gap: 12px; flex-wrap: wrap; }
.br-stat { display: flex; align-items: center; gap: 11px; padding: 10px 16px; border-radius: 14px;
  background: rgba(255,244,205,.1); border: 1px solid rgba(246,213,119,.35); }
.br-stat-ico { width: 34px; height: 34px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center; background: rgba(246,213,119,.18); }
.br-stat-ico img { width: 17px; filter: brightness(0) saturate(100%) invert(84%) sepia(28%) saturate(680%) hue-rotate(342deg) brightness(101%) contrast(94%); }
.br-stat-txt { display: flex; flex-direction: column; line-height: 1.15; }
.br-stat-txt strong { font: 700 18px 'Lora', serif; color: #ffe9b8; }
.br-stat-txt small { font-size: 11.5px; color: #f0d6a8; }
.br-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
.br-hero-illus { display: grid; place-items: center; }
.br-hero-illus img { width: 100%; max-width: 380px; opacity: .96; filter: drop-shadow(0 6px 18px rgba(0,0,0,.25)); }
/* Tổng quan */
.br-overview-text { font-size: 14.5px; color: #4a3a33; line-height: 1.7; margin: 0 0 16px; }
.br-lineage { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.br-line-chip { display: inline-flex; align-items: center; min-height: 30px; padding: 5px 13px; border-radius: 999px;
  background: #f6ead2; color: #7a5a1e; font-size: 12.5px; font-weight: 600; border: 1px solid #ecd8a8; }
.br-line-chip.is-current { background: #fbeecb; color: #8c1c22; border-color: #e0b85a; }
.br-line-sep { color: #c39337; }
/* Các nhánh con */
.br-child-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.br-child { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.br-child-head { display: flex; align-items: center; gap: 12px; }
.br-child-mono { width: 46px; height: 46px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
  background: #efdc9b; color: #781a23; font: 700 15px 'Lora', serif; border: 2px solid #d3ad51; }
.br-child-id strong { display: block; font: 700 16px/1.3 'Lora', serif; color: #7a1420; }
.br-child-id small { color: var(--muted); font-size: 12.5px; }
.br-child-spouse { font-size: 13px; color: #5a4a40; margin: 0; }
.br-child-sub { display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; padding: 5px 12px; border-radius: 999px;
  background: #f4ead3; color: #7a5a1e; font-size: 12px; font-weight: 700; }
.br-child-sub img { width: 14px; opacity: .8; }
.br-child-btn { align-self: stretch; justify-content: center; margin-top: auto; }
/* Phả đồ (danh sách) toolbar */
.br-tree-toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.br-tree-toolbar .tool-button { height: 40px; }
.gt-tree-wrap { max-height: 620px; overflow: auto; margin-top: 6px; }
/* Dấu mốc — timeline */
.br-timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.br-timeline li { display: grid; grid-template-columns: 40px 84px 1fr; align-items: center; gap: 12px; position: relative; padding: 10px 0; }
.br-tl-ico { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #fbeecb; border: 1px solid #e0b85a; z-index: 1; }
.br-tl-ico img { width: 18px; }
.br-timeline li:not(:last-child) .br-tl-ico::after { content: ""; position: absolute; left: 19px; top: 38px; width: 2px; height: calc(100% - 20px); background: #e0c078; }
.br-tl-gen { font: 700 14px 'Lora', serif; color: #8c1c22; }
.br-tl-line { height: 2px; background: #e6d3a0; }
.br-tl-text { color: #4a3a33; font-size: 14px; font-weight: 600; }
/* Nguồn gốc */
.br-origin { position: relative; overflow: hidden; }
.br-origin p { font-size: 14px; color: #4a3a33; line-height: 1.7; max-width: 60%; }
.br-origin-img { position: absolute; right: 10px; bottom: 10px; width: 220px; opacity: .5; pointer-events: none; }
/* CTA cuối */
.br-cta { display: flex; align-items: center; gap: 20px; padding: 24px 28px; flex-wrap: wrap; }
.br-cta-ico { width: 54px; height: 54px; border-radius: 14px; flex: 0 0 auto; display: grid; place-items: center; background: #fbeecb; border: 1px solid #e0b85a; }
.br-cta-ico img { width: 26px; }
.br-cta-text { flex: 1; min-width: 220px; }
.br-cta-text h3 { font: 700 20px 'Lora', serif; color: #7a1420; margin: 0 0 4px; }
.br-cta-text p { font-size: 13.5px; color: var(--muted); margin: 0; }
.br-cta-actions { display: flex; gap: 12px; flex-wrap: wrap; }
@media (max-width: 1023px) {
  .br-hero-grid { grid-template-columns: 1fr; }
  .br-hero-illus { display: none; }
  .br-child-grid { grid-template-columns: 1fr 1fr; }
  .br-origin p { max-width: 100%; }
  .br-origin-img { display: none; }
}
@media (max-width: 640px) {
  .br-hero-main h1 { font-size: 32px; }
  .br-child-grid { grid-template-columns: 1fr; }
  .br-cta { flex-direction: column; text-align: center; }
  .br-cta-actions { width: 100%; }
  .br-cta-actions .btn { flex: 1; }
}

/* ═══════════ Trang nội dung hỗ trợ ═══════════ */
/* Bài viết (giới thiệu / phả ký / tộc ước / hương hoả) */
.prose-card { max-width: 860px; margin: 0 auto; }
.prose-card p { color: #3a2a24; font-size: 15.5px; line-height: 1.8; margin: 0 0 16px; }
.prose-card p.lead { font-size: 17px; font-weight: 600; color: #55131a; }

/* Ngày giỗ */
.memorial-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.memorial-filter .chip {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line);
  background: #fffdf7; color: #5a3a30; font-size: 13px; text-decoration: none;
}
.memorial-filter .chip:hover { border-color: var(--gold); }
.memorial-filter .chip.active { background: #971f2b; color: #ffe8a8; border-color: #971f2b; }
.memorial-month { margin-bottom: 30px; }
.memorial-month-title { display: flex; align-items: center; gap: 10px; font: 700 20px 'Lora', serif; color: #751722; margin-bottom: 14px; }
.memorial-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.memorial-card { display: flex; gap: 14px; align-items: flex-start; padding: 16px; text-decoration: none; }
.memorial-card:hover { border-color: var(--gold); box-shadow: var(--shadow-sm); }
.memorial-card strong { color: #3a2a24; }
.memorial-day-badge {
  flex: 0 0 auto; width: 58px; height: 58px; border-radius: 12px; background: rgba(150,31,34,.08);
  display: grid; place-items: center; text-align: center; color: #971f2b;
}
.memorial-day-badge strong { font: 700 22px 'Lora', serif; color: #971f2b; line-height: 1; }
.memorial-day-badge span { font-size: 10px; color: #9a6414; }

/* Liên hệ */
.contact-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.contact-list li { display: flex; align-items: center; gap: 14px; }
.contact-list small { display: block; color: var(--muted); font-size: 12px; }
.contact-list strong { color: #3a2a24; font-size: 15px; }

/* Form góp ý */
.v2-form { display: flex; flex-direction: column; gap: 16px; }
.v2-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; font-weight: 600; color: #4a3a33; }
.v2-form .req { color: var(--danger); }
.v2-form input, .v2-form textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 14px; font-size: 14px;
  font-family: inherit; color: #3a2a24; background: #fffdf7; width: 100%;
}
.v2-form input:focus, .v2-form textarea:focus { outline: 2px solid var(--gold); border-color: var(--gold); }
.v2-form textarea { resize: vertical; }
.v2-optional { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.v2-form input.v2-file { padding: 9px 12px; background: #fbf6ea; cursor: pointer; font-size: 13px; }
.v2-form input.v2-file::file-selector-button {
  margin-right: 12px; border: 1px solid var(--gold); border-radius: 8px;
  padding: 7px 14px; background: var(--gold-2, #e9c96a); color: #55131a;
  font-weight: 700; font-family: inherit; cursor: pointer;
}
.v2-form label small.v2-inline-note { font-weight: 400; }
.v2-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.v2-form-error {
  background: #fdf1f1; border: 1px solid #e4868b; color: #b42318;
  padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px;
}
.v2-form .btn { align-self: flex-start; }
@media (max-width: 767px) { .v2-form-row { grid-template-columns: 1fr; } }

/* ═══════════════════ CÂY GIA PHẢ bám mockup ═══════════════════ */
/* Đường nối màu ĐỎ (mockup) thay cho vàng của reference */
.tree-node::before, .tree-row::before, .tree-vertical-line { background: #a5303a; }

/* Gốc dạng CẶP: Tiên Tổ ❤ Bà Thủy tổ */
.couple-unit { display: flex; align-items: center; justify-content: center; gap: 16px; position: relative; }
.couple-heart { color: #c0392f; font-size: 22px; flex: 0 0 auto; }
.spouse-node { cursor: default; }
.tree-branch:has(> .tree-row) > .couple-unit::after {
  content: ''; position: absolute; left: 50%; bottom: -50px; width: 2px; height: 50px; background: #a5303a;
}

/* Badge hero dạng pill có icon */
.hero-badge { display: inline-flex; align-items: center; gap: 8px; background: rgba(255,240,190,.1);
  border: 1px solid rgba(214,167,44,.5); color: #fce9c0; padding: 9px 16px; border-radius: 999px; font-size: 13.5px; height: auto; }
.hero-badge img { width: 16px; filter: brightness(0) saturate(100%) invert(85%) sepia(35%) saturate(560%) hue-rotate(357deg) brightness(103%) contrast(95%); }

/* Chú giải giàu (4 mục icon + tiêu đề + mô tả) */
.legend-rich { align-items: stretch; }
.legend-rich .legend-items { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; width: 100%; }
.legend-rich .legend-item { align-items: flex-start; gap: 12px; }
.legend-text { display: flex; flex-direction: column; gap: 2px; }
.legend-text strong { color: #3a2a24; font-size: 14px; }
.legend-text small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.legend-swatch { width: 32px; height: 32px; border-radius: 8px; border: 2px solid #a5303a; background: #fdeef0; flex: 0 0 auto; }
.legend-ico.tip { background: rgba(214,167,44,.18); }
@media (max-width: 1023px) { .legend-rich .legend-items { grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px)  { .legend-rich .legend-items { grid-template-columns: 1fr; } }

/* Dấu mốc phả hệ: 3 mốc địa danh, vòng tròn đỏ nối đường chấm vàng */
.milestone-track { display: flex; justify-content: space-around; gap: 20px; position: relative; padding-top: 6px; }
.milestone-track::before { content: ''; position: absolute; top: 34px; left: 14%; right: 14%; border-top: 2px dotted #d4a72c; z-index: 0; }
.milestone-node { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; text-align: center; max-width: 250px; flex: 1; }
.milestone-dot { width: 66px; height: 66px; border-radius: 50%; background: #971f2b; display: grid; place-items: center; border: 4px solid #f3e0a4; margin-bottom: 14px; box-shadow: 0 6px 16px rgba(90,15,15,.2); }
.milestone-dot img { width: 30px; filter: brightness(0) saturate(100%) invert(85%) sepia(35%) saturate(560%) hue-rotate(357deg) brightness(103%) contrast(95%); }
.milestone-node strong { color: #751722; font: 700 16px 'Lora', serif; }
.milestone-node small { color: var(--muted); font-size: 13px; margin-top: 5px; line-height: 1.45; }
@media (max-width: 767px) { .milestone-track { flex-direction: column; align-items: center; } .milestone-track::before { display: none; } }

/* Nhánh đang chọn (khi focus) */
.tree-node.is-selected { background: #fdeef0; border-color: #a5303a; }

/* ── Cài đặt hiển thị phả đồ (áp từ admin) ── */
.tree-stage{gap:var(--tree-gap,48px)}
.tree-branch > .tree-row{margin-top:var(--tree-gap,48px)}
/* Kiểu "Đứt nét" */
.tree-stage.conn-dot .tree-node::before{background:none;border-left:2px dotted #a5303a;width:0}
.tree-stage.conn-dot .tree-row::before{background:none;border-top:2px dotted #a5303a;height:0}
.tree-stage.conn-dot .tree-vertical-line{background:none;border-left:2px dotted #a5303a;width:0}
/* Kiểu "Thụt lề": bỏ đường nối, xếp con thụt vào trái */
.tree-stage.conn-indent .tree-node::before,
.tree-stage.conn-indent .tree-row::before,
.tree-stage.conn-indent .tree-vertical-line{display:none}
.tree-stage.conn-indent{align-items:flex-start}
.tree-stage.conn-indent .tree-branch{align-items:flex-start}
.tree-stage.conn-indent .tree-branch > .tree-row{flex-direction:column;align-items:flex-start;margin-top:8px;margin-left:26px;gap:8px}
.tree-stage.conn-indent .tree-node{width:auto;min-width:190px}

/* ═══════════ Cây gia phả dạng DANH SÁCH (thụt lề cổ điển) ═══════════ */
.gt-tree-wrap{border:1px solid #d8c48b;border-radius:18px;background:#fffaf0;background-image:linear-gradient(rgba(184,145,61,.05) 1px,transparent 1px);background-size:100% 34px;padding:22px 26px;overflow:auto;box-shadow:inset 0 0 60px rgba(148,93,25,.04)}
.gt-tree,.gt-children{list-style:none;margin:0;padding:0}
.gt-children{padding-left:24px;position:relative}
/* Đường nối kiểu cây thư mục */
.gt-children>.gt-li{position:relative}
.gt-children>.gt-li::before{content:'';position:absolute;left:-12px;top:0;bottom:0;border-left:1.5px solid #d3b871}
.gt-children>.gt-li:last-child::before{bottom:auto;height:17px}
.gt-children>.gt-li::after{content:'';position:absolute;left:-12px;top:17px;width:12px;border-top:1.5px solid #d3b871}
/* Dòng thành viên */
.gt-node{display:flex;align-items:center;gap:8px;padding:4px 8px;border-radius:8px;position:relative;min-height:30px}
.gt-node:hover{background:rgba(214,167,44,.14)}
.gt-toggle{width:18px;height:18px;flex:0 0 auto;border:1px solid #c9a24a;border-radius:4px;background:#fffdf7;color:#8a5a12;font:700 13px/1 'Be Vietnam Pro',sans-serif;display:grid;place-items:center;cursor:pointer;padding:0}
.gt-toggle.empty{border:0;background:none;cursor:default}
.gt-ped{font-size:11px;font-weight:700;color:#8a5a12;background:#f4e4ba;border:1px solid #e6cf94;border-radius:6px;padding:1px 7px;flex:0 0 auto}
.gt-ico{width:22px;height:22px;flex:0 0 auto;border-radius:50%;background:#efe4d3;display:grid;place-items:center}
.gt-ico.alive{background:#e2f3e8}
.gt-ico img{width:14px;filter:brightness(0) saturate(100%) invert(28%) sepia(20%) saturate(1200%) hue-rotate(335deg) brightness(85%)}
.gt-name{font:700 15px/1.3 'Lora',serif;color:#7a1420;text-decoration:none}
.gt-name:hover{text-decoration:underline}
.gt-sp{color:#97672a;font-size:13.5px}
.gt-li.collapsed>.gt-children{display:none}
.gt-node.is-match{background:#fdeef0;outline:2px solid var(--gold);outline-offset:1px}
@media print{.gt-li.collapsed>.gt-children{display:block!important}.gt-toggle{display:none}.gt-tree-wrap{border:0;box-shadow:none}}
