/* Contextual person panels and readable access administration. */
.topbar { gap: 14px; }
.account-menu { position: relative; flex-shrink: 0; }
.account-menu > summary { cursor: pointer; list-style: none; border: 1px solid var(--line); border-radius: 9px; padding: 11px 13px; min-height: 44px; font-size: .875rem; background: var(--paper); }
.account-menu > summary::after { content: ' ▾'; }
.account-options { position: absolute; top: calc(100% + 8px); right: 0; z-index: 95; width: min(310px, calc(100vw - 24px)); padding: 16px; background: var(--paper); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 40px #203d3430; display: flex; flex-direction: column; gap: 9px; }
.account-options p { font-size: .875rem; overflow-wrap: anywhere; margin: 0; }
.account-options .private { order: -1; font-weight: 600; color: var(--green); }
.account-options .export-label { display: inline; }
.account-options .button { justify-content: flex-start; width: 100%; min-height: 44px; }
#account-status:empty { display: none; }
.tree-relationship-explanation { border-inline: 1px solid #cdd8ce; margin: 0; background: #f0f4ed; padding: 10px 16px; font-size: .875rem; color: #354f3d; }
.profile-dialog { z-index: 80; inset: 12px 12px 12px auto; width: 440px; max-width: calc(100vw - 24px); height: calc(100dvh - 24px); max-height: none; border: 1px solid #c3cec0; border-radius: 16px; margin: 0; box-shadow: -8px 4px 40px #203d342b; overscroll-behavior: contain; }
.profile-cover { height: 64px; padding: 20px 22px; position: sticky; top: 0; z-index: 3; align-items: center; }
.profile-cover .close-button { margin: 0; min-width: 44px; min-height: 44px; }
.profile-content { padding: 20px 20px calc(28px + env(safe-area-inset-bottom)); }
.person-panel-heading { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; }
.person-panel-heading > div { min-width: 0; }
.person-panel-heading .avatar.large { width: 64px; height: 64px; font-size: 22px; }
.person-panel-heading h2 { font-size: 1.75rem; margin: 0 0 5px; }
.person-panel-heading p { font-size: .875rem; margin: 3px 0; color: var(--muted); }
.profile-main-action { width: 100%; min-height: 46px; text-align: center; }
.profile-tabs { position: sticky; top: 64px; z-index: 2; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 3px; margin: 18px -8px 20px; padding: 5px; border-radius: 10px; background: #e9eee4; border: 1px solid #d5dfcf; }
.profile-tabs button { min-height: 48px; font-size: .8125rem; line-height: 1.3; padding: 6px 3px; border-radius: 7px; background: transparent; overflow-wrap: anywhere; }
.profile-tabs button[aria-selected=true] { color: white; background: var(--green); font-weight: 600; }
.profile-tab-panel { outline-offset: 3px; }
.kinship-card { padding: 14px; background: #eff3e9; border: 1px solid #d4dfc9; border-radius: 10px; }
.kinship-card > span { display: block; font-size: .75rem; color: #526649; }
.kinship-card p { margin: 7px 0 12px; font-size: .9375rem; }
.kinship-card .button { min-height: 44px; }
.profile-tab-panel .profile-section:first-child { margin-top: 0; }
.profile-tab-panel .profile-tools { gap: 8px; flex-wrap: wrap; }
.profile-tab-panel .button { min-height: 44px; }
.profile-tab-panel .relation-row { min-height: 64px; }
.person-life-events { border-left: 2px solid #c3d0b8; margin: 24px 0 0 7px; padding-left: 18px; }
.person-life-events .profile-event { position: relative; padding: 14px; margin: 0 0 18px; border: 1px solid var(--line); background: white; border-radius: 10px; }
.person-life-events .profile-event::before { content: ''; position: absolute; left: -25px; top: 20px; border: 3px solid var(--paper); width: 12px; height: 12px; background: var(--green); border-radius: 50%; }
.person-life-events time { display: block; font-size: .8125rem; color: #6c644e; margin-bottom: 5px; }
.person-life-events h4 { margin: 6px 0; font-size: 1rem; }
.person-life-events p { font-size: .9375rem; overflow-wrap: anywhere; white-space: pre-line; }
.members-dialog { width: min(760px, calc(100vw - 24px)); }
.member-login { display: flex; align-items: flex-end; gap: 8px; margin: 20px 0; }
.member-login .form-field { min-width: 0; flex: 1; margin: 0; }
.member-login input { width: 100%; font-size: .8125rem; }
#member-form-area { padding: 18px; background: #f0f3eb; border: 1px solid var(--line); border-radius: 12px; margin: 18px 0; }
#member-form-area h3 { margin-bottom: 14px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.member-row > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.member-row strong, .member-row small { display: block; }
.member-row small { color: var(--muted); font-size: .8125rem; }
.member-badge { background: #e9eee2; color: #3b5737; padding: 5px 8px; border-radius: 6px; font-size: .75rem; }
#member-log { margin: 22px 0; }
#member-log summary { padding: 12px 0; cursor: pointer; }
#member-log p { font-size: .8125rem; overflow-wrap: anywhere; border-bottom: 1px solid var(--line); padding: 10px 0; }
@media (min-width: 1200px) {
  .has-tree-profile #view-tree { padding-right: 432px; }
  .profile-dialog.tree-profile { width: 400px; }
  .has-tree-profile .tree-parent-links { flex-basis: 100%; max-width: none; }
}
@media (max-width: 1199px) {
  .profile-dialog.tree-profile { inset: auto 0 0; width: 100%; max-width: 100%; height: 56dvh; max-height: 56dvh; border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px #203d3426; }
  .tree-profile .profile-content { max-width: 660px; margin-inline: auto; }
  .tree-profile .profile-cover { height: 54px; padding-block: 10px; }
  .tree-profile .profile-tabs { top: 54px; }
}
@media (max-width: 760px) {
  .topbar { gap: 8px; padding-inline: 12px; }
  .topbar .search-wrap { width: auto; flex: 1; min-width: 0; }
  .account-menu > summary { font-size: .75rem; padding: 12px 8px; }
  .account-menu .private { display: block; }
  .profile-dialog { inset: 0; width: 100%; max-width: 100%; height: 100dvh; border-radius: 0; }
  .profile-tabs { font-size: .75rem; }
  .profile-content { padding-inline: 16px; }
  .person-panel-heading h2 { font-size: 1.5rem; }
  .member-row { flex-wrap: wrap; }
  .member-row > div { flex-basis: 100%; }
  .member-login { flex-wrap: wrap; }
  .member-login .form-field { flex-basis: 100%; }
}
