/* Person profile, cards and "add a relative" search. */

.section-title { font-size: var(--fs-md); }
.section-actions { gap: var(--s2); justify-content: flex-end; }
.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4); }
.profile-head__text { flex: 1 1 200px; min-width: 0; gap: var(--s2); }
.profile-head__name { font-size: var(--fs-xl); overflow-wrap: anywhere; }
.profile-head__actions { width: 100%; }
@media (min-width: 600px) { .profile-head__actions { width: auto; } }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--s4); margin: var(--s3) 0 0; font-size: var(--fs-sm); }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.bio { margin-top: var(--s3); color: var(--muted); font-style: italic; }

.person-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--s2); }
.person-card {
  display: flex; align-items: center; gap: var(--s3); min-height: 56px; padding: 8px 10px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--text); text-decoration: none; min-width: 0;
}
.person-card:hover { border-color: var(--gold); }
.person-card__text { display: flex; flex-direction: column; min-width: 0; }
.person-card__name { font-weight: 600; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-card__name.is-unnamed { font-style: italic; color: var(--muted); }
.person-card__sub { font-size: var(--fs-xs); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.search-results { display: flex; flex-direction: column; gap: 6px; }
.search-results button {
  display: flex; align-items: center; gap: var(--s3); width: 100%; min-height: var(--tap); padding: 8px 10px; text-align: left;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer;
}
.search-results button[aria-selected="true"] { border-color: var(--leaf); box-shadow: 0 0 0 1px var(--leaf) inset; }
.search-results .muted { font-size: var(--fs-sm); }

/* Checklist (M2 task 7) */
.progress-ring { --p: 0; width: 84px; height: 84px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--leaf) calc(var(--p) * 1%), var(--surface-2) 0); }
.progress-ring span { width: 66px; height: 66px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; }
.checklist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.checklist li { display: flex; align-items: center; gap: var(--s3); padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); flex-wrap: wrap; }
.checklist .tick { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--muted); flex: none; font-size: 14px; }
.checklist li.is-done .tick { background: var(--leaf); border-color: var(--leaf); color: var(--on-accent); }
.checklist .grow { min-width: 140px; }

/* progress ring steps (no inline styles under the CSP) */
.progress-ring--0 { --p: 0; }
.progress-ring--5 { --p: 5; }
.progress-ring--10 { --p: 10; }
.progress-ring--15 { --p: 15; }
.progress-ring--20 { --p: 20; }
.progress-ring--25 { --p: 25; }
.progress-ring--30 { --p: 30; }
.progress-ring--35 { --p: 35; }
.progress-ring--40 { --p: 40; }
.progress-ring--45 { --p: 45; }
.progress-ring--50 { --p: 50; }
.progress-ring--55 { --p: 55; }
.progress-ring--60 { --p: 60; }
.progress-ring--65 { --p: 65; }
.progress-ring--70 { --p: 70; }
.progress-ring--75 { --p: 75; }
.progress-ring--80 { --p: 80; }
.progress-ring--85 { --p: 85; }
.progress-ring--90 { --p: 90; }
.progress-ring--95 { --p: 95; }
.progress-ring--100 { --p: 100; }
.checklist-teaser { text-decoration: none; color: var(--text); }

.person-card-wrap { position: relative; min-width: 0; }
.person-card-wrap .person-card { padding-right: 52px; }
.person-card__unlink { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.icon-btn--sm { width: 36px; height: 36px; font-size: 18px; line-height: 1; color: var(--muted); }
.icon-btn--sm:hover { color: var(--root); border-color: var(--root); }

/* matching, merges, notifications (M4) */
.match-card { display: flex; flex-direction: column; gap: 6px; padding: var(--s3); border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); min-width: 0; }
.match-card__name { font-size: var(--fs-md); }
.match-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s2); }
.match-option { display: flex; gap: var(--s3); align-items: flex-start; cursor: pointer; }
.match-option input { margin-top: 18px; width: 20px; height: 20px; accent-color: var(--leaf); flex: none; }
.match-option .match-card { flex: 1; }
.match-option--none { align-items: center; padding: var(--s3); border: 1px dashed var(--border); border-radius: 12px; }
.match-option--none input { margin-top: 0; }
.merge-table { display: flex; flex-direction: column; gap: var(--s2); }
.merge-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--s2); align-items: center; border: 0; padding: 0; margin: 0; min-width: 0; }
.merge-row legend { float: left; font-weight: 600; font-size: var(--fs-sm); padding: 0; }
.merge-row label { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); overflow-wrap: anywhere; }
.merge-row--head span { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .1em; }
@media (max-width: 520px) { .merge-row { grid-template-columns: 1fr 1fr; } .merge-row legend, .merge-row--head span:first-child { grid-column: 1 / -1; } }
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.notif-list li { display: flex; gap: var(--s3); align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); flex-wrap: wrap; }
.notif-dot { width: 10px; height: 10px; border-radius: 50%; background: transparent; flex: none; }
.is-unread .notif-dot { background: var(--leaf); box-shadow: 0 0 8px var(--leaf); }

/* invitations (M4) */
.invite-channels { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--s2); }
.invite-result { padding: var(--s3); border: 1px dashed var(--leaf); border-radius: 12px; }
.invite-result input[readonly] { font-size: var(--fs-sm); }
.avatar--xl { width: 120px; height: 120px; font-size: 2rem; }
.profile-head__photo { position: relative; flex: none; }
.profile-head__upload { position: absolute; right: -4px; bottom: -4px; margin: 0; }
.profile-head__upload label { cursor: pointer; background: var(--surface); }
.profile-head__upload label:focus-within { outline: 2px solid var(--leaf); outline-offset: 2px; }
.profile-posts-title { margin-top: var(--s2); }
.union-edit { margin-top: var(--s2); font-size: var(--fs-sm); }
.union-edit summary { cursor: pointer; color: var(--muted); }
.union-edit form { margin-top: var(--s2); align-items: flex-end; }
.union-edit .field { flex: 1 1 180px; margin: 0; }

/* duplicates and merges — phone first */
.dup-alert {
  display: flex; align-items: center; gap: var(--s3); padding: 12px 14px; border-radius: 14px; text-decoration: none; color: var(--text);
  border: 1px solid color-mix(in srgb, var(--gold) 50%, var(--border)); background: color-mix(in srgb, var(--gold) 10%, var(--surface));
  font-weight: 600; font-size: var(--fs-sm);
}
.dup-alert svg { width: 22px; height: 22px; color: var(--gold); flex: none; }
.dup-alert__go { flex: none; padding: 6px 12px; border-radius: 999px; background: var(--gold); color: var(--on-accent); font-size: var(--fs-xs); }
@media (min-width: 900px) { .dup-alert { display: none; } }   /* the family panel shows it on large screens */
.match-actions { gap: var(--s2); }
.match-actions .btn svg { width: 18px; height: 18px; }
@media (max-width: 520px) {
  .match-actions { flex-direction: column; align-items: stretch; }
  .match-actions > form, .match-actions > a { width: 100%; }
  .match-actions .btn { width: 100%; min-height: 48px; }
  .match-pair { grid-template-columns: 1fr; }
}
.merge-head--done { border-color: color-mix(in srgb, var(--leaf) 45%, var(--border)); }
.merge-todo { display: flex; align-items: center; gap: var(--s3); padding: 14px; border-radius: 14px; text-decoration: none; color: var(--text);
  background: color-mix(in srgb, var(--gold) 10%, var(--surface-2)); border: 1px solid color-mix(in srgb, var(--gold) 45%, var(--border)); }
.merge-todo > span.grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.merge-todo__n { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; background: var(--gold); color: var(--on-accent); }
.merge-todo svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.merge-undo { align-self: flex-start; }
.merge-undo .link-btn { color: var(--root); font-size: var(--fs-sm); }
.review-person__name { font-size: var(--fs-lg); }
.review-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s2); border: 0; padding: 0; margin: 0; min-width: 0; }
.review-row legend { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s2); font-weight: 700; font-size: var(--fs-sm); padding: 0; margin-bottom: 6px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.review-row + .review-row { padding-top: var(--s3); border-top: 1px solid var(--border); }
.review-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 2px solid var(--border); border-radius: 12px; background: var(--surface-2); cursor: pointer; min-width: 0; min-height: 56px; }
.review-opt input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--leaf); flex: none; }
.review-opt > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.review-opt small { font-size: var(--fs-xs); }
.review-opt:has(input:checked) { border-color: var(--leaf); background: color-mix(in srgb, var(--leaf) 10%, var(--surface-2)); }
.review-row.is-pending legend::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.review-bar { position: sticky; bottom: calc(66px + env(safe-area-inset-bottom, 0px)); z-index: 5; display: flex; gap: var(--s2); padding: 10px; border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--border); box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
@media (min-width: 900px) { .review-bar { bottom: var(--s3); } }
@media (max-width: 520px) { .review-row { grid-template-columns: 1fr; } }
