/* My Family v2.4.23 — application-wide responsive density and tree group controls */
:root{
  --mf-v2423-font:15px;
  --mf-v2423-small:12px;
  --mf-v2423-control:44px;
  --mf-v2423-card-pad:16px;
  --mf-v2423-gap:14px;
  --mf-v2423-radius:18px;
  --mf-v2423-content-pad:clamp(12px,1.8vw,28px);
}
html.mobile-mode-modern,body.mobile-mode-modern{--mf-v2423-font:14px;--mf-v2423-small:11px;--mf-v2423-control:42px;--mf-v2423-card-pad:14px;--mf-v2423-gap:12px;--mf-v2423-radius:16px}
html.mobile-mode-comfortable,body.mobile-mode-comfortable{--mf-v2423-font:15px;--mf-v2423-small:12px;--mf-v2423-control:46px;--mf-v2423-card-pad:17px;--mf-v2423-gap:14px;--mf-v2423-radius:19px}
html.mobile-mode-large,body.mobile-mode-large{--mf-v2423-font:17px;--mf-v2423-small:13px;--mf-v2423-control:50px;--mf-v2423-card-pad:20px;--mf-v2423-gap:16px;--mf-v2423-radius:21px}
html.mobile-mode-senior,body.mobile-mode-senior{--mf-v2423-font:19px;--mf-v2423-small:15px;--mf-v2423-control:56px;--mf-v2423-card-pad:22px;--mf-v2423-gap:18px;--mf-v2423-radius:24px}

html,body{max-width:100%;overflow-x:hidden;text-size-adjust:100%;-webkit-text-size-adjust:100%}
body{font-size:var(--mf-v2423-font);line-height:1.45}
body .content.app-main,body .content{min-width:0;width:100%;padding:var(--mf-v2423-content-pad)}
body .card,body .quick-card,body .feed-post,body .metric{min-width:0;padding:var(--mf-v2423-card-pad);border-radius:var(--mf-v2423-radius)}
body .cards,body .grid2,body .grid3,body .settings-grid,body .quick-cards,body .people-responsive-grid,body .dashboard-metrics{gap:var(--mf-v2423-gap);min-width:0}
body .cards{grid-template-columns:repeat(auto-fit,minmax(min(220px,100%),1fr))}
body .grid2{grid-template-columns:repeat(auto-fit,minmax(min(320px,100%),1fr))}
body .grid3,body .people-responsive-grid{grid-template-columns:repeat(auto-fit,minmax(min(250px,100%),1fr))}
body .settings-grid{grid-template-columns:repeat(auto-fit,minmax(min(290px,100%),1fr))}
body .page-head{min-width:0;flex-wrap:wrap;align-items:flex-start;gap:10px}
body .page-head h1{font-size:clamp(calc(var(--mf-v2423-font) * 1.55),2.2vw,32px);line-height:1.12;overflow-wrap:anywhere}
body .page-head .actions{min-width:0;max-width:100%;align-items:center}
body .btn,body button.btn,body input,body select,body textarea{min-height:var(--mf-v2423-control);font-size:var(--mf-v2423-font);max-width:100%}
body .btn.small,body button.btn.small{min-height:max(36px,calc(var(--mf-v2423-control) - 6px));font-size:var(--mf-v2423-small)}
body .field{min-width:0}
body .field label,body small,body .muted{font-size:var(--mf-v2423-small)}
body .field input,body .field select,body .field textarea{width:100%;min-width:0}
body .form-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:var(--mf-v2423-gap);min-width:0}
body .actions,body .top-actions,body .member-actions,body .people-actions{max-width:100%}
body img,body video{max-width:100%}
body .table-card,body .table-scroll,body .responsive-table,body .data-table-wrap{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
body .table{min-width:640px;font-size:var(--mf-v2423-font)}
body .table th{font-size:var(--mf-v2423-small);white-space:nowrap}
body .table td{vertical-align:top;overflow-wrap:anywhere}
body .notice,body .warning,body .dangerbox{overflow-wrap:anywhere}
body .modal{padding:max(8px,env(safe-area-inset-top)) max(8px,env(safe-area-inset-right)) max(8px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left))}
body .modal-card{width:min(900px,calc(100vw - 16px));max-height:calc(100dvh - 16px);padding:var(--mf-v2423-card-pad);border-radius:var(--mf-v2423-radius);overscroll-behavior:contain}
body .modal-head{gap:8px;align-items:flex-start}
body .modal-head h2{font-size:clamp(calc(var(--mf-v2423-font) * 1.35),3vw,28px);overflow-wrap:anywhere}
body .date-quick{display:flex;flex-wrap:wrap;gap:6px}
body .date-quick button{min-height:34px;flex:1 1 84px}
body .life-death-field.hidden{display:none!important}

/* Desktop and wide-screen containment */
@media(min-width:1280px){
  body .app-shell{grid-template-columns:minmax(238px,282px) minmax(0,1fr)}
  body .content.app-main>*,body .content>*{max-width:1800px;margin-left:auto;margin-right:auto}
  body .tree-desktop-layout-v2417{grid-template-columns:minmax(0,1fr) minmax(300px,380px);align-items:start}
  body .tree-member-panel-v2417{position:sticky;top:0;max-height:calc(100dvh - 28px);overflow:auto}
}
@media(min-width:1800px){
  body .app-shell{grid-template-columns:290px minmax(0,1fr)}
  body .content.app-main>*,body .content>*{max-width:1920px}
  body .cards{grid-template-columns:repeat(auto-fit,minmax(250px,1fr))}
}

/* Family tree group control and stable desktop toolbar */
body .tree-main-pane{min-width:0;overflow:visible}
body .tree-head-toolbar.tree-options-v249{display:grid!important;grid-template-columns:minmax(180px,1.2fr) minmax(190px,1fr) minmax(190px,1fr) auto!important;align-items:center!important;gap:8px!important;width:100%!important;overflow:visible!important}
body .tree-head-toolbar.tree-options-v249 input,
body .tree-head-toolbar.tree-options-v249 select{width:100%!important;min-width:0!important;max-width:none!important;flex:auto!important;height:var(--mf-v2423-control)!important}
body .tree-head-toolbar .tree-group-select{font-weight:850}
body .tree-head-toolbar .tree-action-menu-v249{min-width:0}
body .tree-head-toolbar .tree-options-summary{min-height:var(--mf-v2423-control);white-space:nowrap}
body .tree-action-list-v249{max-height:min(60dvh,420px);overflow:auto}
body .tree-group-empty{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);width:min(420px,calc(100vw - 48px))}
body .tree-stage-pro{min-width:0;max-width:100%;height:clamp(520px,calc(100dvh - 190px),920px)}
body .tree-fullscreen .tree-stage-pro{height:auto!important;min-height:0!important}
body .tree-fullscreen .tree-head-toolbar.tree-options-v249{grid-template-columns:minmax(160px,1.2fr) minmax(170px,1fr) minmax(170px,1fr) auto!important}

/* Tablet */
@media(min-width:901px) and (max-width:1279px){
  body .app-shell{grid-template-columns:minmax(210px,240px) minmax(0,1fr)}
  body .sidebar{position:sticky;height:100dvh;top:0;overflow:auto}
  body .side-menu{grid-template-columns:1fr}
  body .content{padding:16px}
  body .cards{grid-template-columns:repeat(2,minmax(0,1fr))}
  body .tree-desktop-layout-v2417{grid-template-columns:minmax(0,1fr) minmax(270px,330px)}
  body .tree-member-panel-v2417{position:sticky;top:0;max-height:calc(100dvh - 20px);overflow:auto}
  body .tree-head-toolbar.tree-options-v249{grid-template-columns:minmax(150px,1fr) minmax(170px,1fr);}
  body .tree-head-toolbar.tree-options-v249 .tree-action-menu-v249{justify-self:stretch}
  body .tree-head-toolbar.tree-options-v249 .tree-options-summary{width:100%}
}

/* Phone and small tablet */
@media(max-width:900px){
  :root{--mf-v2423-content-pad:10px}
  body .app-shell{display:block;min-width:0}
  body .content.app-main,body .content{padding:10px;padding-bottom:calc(88px + env(safe-area-inset-bottom))}
  body .page-head{display:flex!important;flex-direction:column!important;align-items:stretch!important;margin-bottom:12px}
  body .page-head .actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));width:100%;gap:8px}
  body .page-head .actions>*{min-width:0;width:100%}
  body .cards,body .grid2,body .grid3,body .settings-grid,body .people-responsive-grid{grid-template-columns:1fr}
  body .dashboard-color-grid,body .dashboard-shortcut-grid-v2332,body .quick-cards{grid-template-columns:repeat(2,minmax(0,1fr))}
  body .form-grid{grid-template-columns:1fr}
  body .full{grid-column:1}
  body .modal{padding:0!important;align-items:stretch!important}
  body .modal-card{width:100vw!important;max-width:100vw!important;min-height:100dvh;max-height:100dvh!important;border-radius:0!important;padding:max(12px,env(safe-area-inset-top)) 12px calc(14px + env(safe-area-inset-bottom))}
  body .modal-head{position:sticky;top:calc(-1 * max(12px,env(safe-area-inset-top)));padding-top:max(12px,env(safe-area-inset-top));background:var(--card,#fff);z-index:8}
  body .tree-desktop-layout-v2417{display:block!important}
  body .tree-member-panel-v2417{display:none!important}
  body .tree-head-toolbar.tree-options-v249{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:7px!important}
  body .tree-head-toolbar.tree-options-v249 #treeSearch{grid-column:1/-1!important}
  body .tree-head-toolbar.tree-options-v249 .tree-action-menu-v249{width:100%!important}
  body .tree-head-toolbar.tree-options-v249 .tree-options-summary{width:100%!important}
  body .tree-stage-pro{height:calc(100dvh - 215px);min-height:430px!important;border-radius:16px!important}
  body .tree-pan-help{max-width:calc(100% - 18px);white-space:normal}
  body .tree-fullscreen{padding:max(6px,env(safe-area-inset-top)) max(6px,env(safe-area-inset-right)) max(6px,env(safe-area-inset-bottom)) max(6px,env(safe-area-inset-left))!important}
  body .tree-fullscreen .tree-fullscreen-controls{grid-template-columns:1fr!important}
  body .tree-fullscreen .tree-head-toolbar.tree-options-v249{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body .tree-fullscreen-member-sheet{max-height:68dvh!important}
  body .status-strip{scroll-snap-type:x proximity;overscroll-behavior-inline:contain}
  body .status{scroll-snap-align:start}
  body .media-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  body .people-card,body .feed-post,body .event-card{overflow:hidden}
  body .member-info-grid,body .compact-member-grid{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  body .member-actions,body .compact-member-actions,body .people-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  body .member-actions .btn,body .compact-member-actions .btn,body .people-actions .btn{width:100%;min-width:0;white-space:normal}
  body .table-card{padding:10px}
  body .table{min-width:720px}
}

@media(max-width:560px){
  body .dashboard-color-grid,body .dashboard-shortcut-grid-v2332,body .quick-cards{grid-template-columns:repeat(2,minmax(0,1fr))}
  body .page-head .actions{grid-template-columns:1fr}
  body .tree-head-toolbar.tree-options-v249{grid-template-columns:1fr!important}
  body .tree-head-toolbar.tree-options-v249 #treeSearch{grid-column:1!important}
  body .tree-head-toolbar.tree-options-v249 .tree-action-menu-v249{width:100%!important}
  body .tree-head-toolbar.tree-options-v249 .tree-options-summary{width:100%!important}
  body .tree-fullscreen .tree-head-toolbar.tree-options-v249{grid-template-columns:1fr!important}
  body .member-info-grid,body .compact-member-grid,body .member-actions,body .compact-member-actions,body .people-actions{grid-template-columns:1fr!important}
  body .media-grid{grid-template-columns:1fr}
  body .date-quick button{flex:1 1 calc(50% - 6px)}
  body .toast{left:8px;right:8px;bottom:calc(82px + env(safe-area-inset-bottom));max-width:none}
}

@media(max-width:360px){
  :root{--mf-v2423-content-pad:7px}
  body .content.app-main,body .content{padding-left:7px;padding-right:7px}
  body .dashboard-color-grid,body .dashboard-shortcut-grid-v2332,body .quick-cards{grid-template-columns:1fr}
  body .card,body .quick-card,body .feed-post{padding:12px}
  body .btn{padding-left:10px;padding-right:10px}
}

/* Short landscape screens and foldables */
@media(max-height:620px) and (orientation:landscape){
  body .content.app-main,body .content{padding-top:8px}
  body .page-head{margin-bottom:8px}
  body .tree-stage-pro{height:calc(100dvh - 128px);min-height:300px!important}
  body .modal-card{max-height:100dvh!important}
  body .tree-fullscreen-member-sheet{max-height:84dvh!important}
}

/* Prevent density modes from creating horizontal page overflow. */
body.mobile-mode-large .sidebar,body.mobile-mode-senior .sidebar{min-width:0}
body.mobile-mode-large .side-menu button,body.mobile-mode-senior .side-menu button{white-space:normal;line-height:1.2}
body.mobile-mode-large .table,body.mobile-mode-senior .table{font-size:var(--mf-v2423-font)}
body.mobile-mode-senior .btn,body.mobile-mode-senior input,body.mobile-mode-senior select,body.mobile-mode-senior textarea{line-height:1.25}
/* Preserve the v2.4.17 desktop alignment contract while the toolbar uses a responsive grid. */
.tree-desktop-layout-v2417>.tree-main-pane>.tree-head-toolbar{justify-content:flex-start!important}
.tree-member-panel-v2417{top:0!important}
