/* Mobile layout for /giapha and /phuhuy only */
.family-list-mobile-toggle { display: none; }
.family-person-link { color: inherit; text-decoration: none; display: block; cursor: pointer; }
.family-person-link:hover, .family-person-link:focus-visible { color: #1677ff; text-decoration: underline; }
.family-person-link:focus-visible { outline: 2px solid #1677ff; outline-offset: 3px; border-radius: 4px; }
@media (max-width: 767.98px) {
  #page-controls { padding: 8px !important; }
  #shared-family-header > div { margin: 0 !important; align-items: stretch !important; gap: 6px; }
  #shared-family-header .branch-tabs { display: flex !important; flex-wrap: wrap; justify-content: flex-start; width: auto !important; gap: 6px; }
  #shared-family-header .branch-tabs .branch-btn { grid-column: auto !important; justify-self: initial !important; padding: 7px 12px; min-height: 34px; font-size: 12px; }
  .family-list-mobile-toggle { display: inline-flex; align-items: center; justify-content: center; width: 100%; padding: 7px 12px; margin: 8px 0 3px; border: 1px solid #b6cffa; border-radius: 8px; background: #f2f7ff; color: #125bbd; font-size: 13px; font-weight: 650; }
  #shared-family-header .branch-search, #branch-info, #ky-tracks { display: none !important; }
  body.family-list-details-open #shared-family-header .branch-search { display: flex !important; width: 100% !important; flex-wrap: wrap; }
  body.family-list-details-open #branch-info { display: flex !important; max-height: none !important; overflow: visible !important; }
  body.family-list-details-open #ky-tracks { display: flex !important; max-height: none !important; overflow: visible !important; }
  #shared-family-header .branch-search #legend { gap: 6px !important; }
  #shared-family-header .legend-item { font-size: 11px; padding: 4px !important; }
  #FamilyChart { padding: 3px !important; margin-bottom: 12px !important; }
  #FamilyChart .table-container { padding: 0 !important; }
  #FamilyChart table { font-size: 12px !important; }
  #FamilyChart th, #FamilyChart td { padding: 6px 5px !important; font-size: 12px !important; }
  #FamilyChart .name-cell { gap: 5px !important; }
  #FamilyChart .avatar { width: 28px !important; height: 28px !important; min-width: 28px !important; }
  #FamilyChart .name-text { font-size: 13px !important; }
  #FamilyChart .table-actions { gap: 4px !important; display: flex; flex-wrap: wrap; justify-content: flex-end; }
  #FamilyChart .table-actions button { font-size: 11px !important; padding: 5px 7px !important; }
  #FamilyChart .table-actions-header { min-width: 118px; }
}
@media print { .family-list-mobile-toggle { display: none !important; } }

/* Desktop: row navigates. Mobile: only the explicit tree icon navigates. */
.family-open-tree { display: none; }
@media (min-width: 768px) {
  #FamilyChart tr[data-person-id] { cursor: pointer; }
  #FamilyChart tr[data-person-id]:hover { background: #f1f7ff; }
}
@media (max-width: 767.98px) {
  #FamilyChart tr[data-person-id] { cursor: default !important; }
  #FamilyChart tr[data-person-id]:focus { outline: none; }
  #FamilyChart .family-open-tree {
    display: inline-flex; justify-content: center; align-items: center;
    width: 40px; height: 40px; border-radius: 11px;
    color: #1764d2; background: #eaf3ff; border: 1px solid #caddfa;
    text-decoration: none; touch-action: manipulation;
  }
  #FamilyChart .family-open-tree:focus-visible { outline: 2px solid #1764d2; outline-offset: 2px; }
  #FamilyChart .family-person-action-cell { text-align: right; padding-right: 8px !important; }
  #FamilyChart .table-actions-cell { width: 52px !important; }
  .family-list-mobile-toggle { background: #fff; border-color: #d7e3f3; color: #175db9; }
  #shared-family-header .branch-search { display: none !important; }
  #shared-family-header.family-menu-open .branch-search { display: flex !important; }
}
@media print { .family-person-action-cell, .family-open-tree { display: none !important; } }
@media (max-width: 767.98px) {
  #shared-family-header.family-menu-open .family-header-menu .branch-search { display: flex !important; }
  #shared-family-header:not(.family-menu-open) .family-header-menu { display:none !important; }
}
