/* Tree-first mobile home only: preserve desktop layout and chart interactions. */
@media (max-width: 767.98px) {
  html, body { height:100%; height:100dvh; overflow:hidden !important; }
  body > .flex.flex-column { height:100dvh !important; display:flex !important; flex-direction:column !important; min-height:0; padding:8px 8px 0 !important; }
  #shared-family-header { flex:0 0 auto; }
  #branch-info, #ky-tracks { flex:0 0 auto; background:#fff; border-radius:10px; margin:0 0 5px !important; }
  #branch-info:not(.is-open), #ky-tracks:not(.is-open) { display:none !important; max-height:0 !important; padding:0 !important; }
  #branch-info.is-open { display:flex !important; max-height:min(45dvh,350px) !important; overflow-y:auto !important; overflow-x:hidden !important; padding:9px 5px !important; }
  #ky-tracks.is-open { display:flex !important; max-height:80px !important; overflow:hidden !important; }
  #branch-info #family-total { overflow-x:auto; white-space:nowrap; flex-wrap:nowrap; }
  #branch-info #stats-detail { overflow-x:auto !important; }
  #FamilyChart { flex:1 1 auto !important; min-height:0 !important; height:auto !important; width:100% !important; border:1px solid #e8edf4; border-radius:12px; padding:6px !important; overflow:hidden !important; touch-action:pan-x pan-y; }
  #FamilyChart #chartSearchRow { min-height:42px; }
  #FamilyChart #chartSearchRow input { height:40px; padding:8px 12px !important; border:1px solid #d6e0ed; border-radius:10px; background:white; font-size:14px; }
  #FamilyChart .mobile-sections-toggle { display:none !important; }
  #FamilyChart > div[style*="top: 2px"] { top:8px !important; left:8px !important; width:calc(100% - 16px) !important; max-width:420px !important; }
  #buildInfo { font-size:9px !important; bottom:2px !important; left:14px !important; }
}
