:root {
  --cream: #f4ead8;
  --parchment: #fff8e9;
  --sage: #d9dfc4;
  --moss: #6f7f52;
  --leaf: #3f5f3c;
  --bark: #6e4c34;
  --charcoal: #3d3429;
  --male-tint: #d8e2d0;
  --female-tint: #f1ded1;
  --other-tint: #eadfbd;
  --line: rgba(97, 76, 49, .22);
  --shadow: 0 20px 50px rgba(61, 52, 41, .12);
  --serif: "Cormorant Garamond", Garamond, "Palatino Linotype", serif;
  --sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --script: "Pinyon Script", "Playfair Display", cursive;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--charcoal);
  background:
    radial-gradient(circle at top left, rgba(217, 223, 196, .8), transparent 34rem),
    linear-gradient(135deg, var(--cream), #f8f0df 45%, #e8dcc2);
  font-family: var(--sans);
}
a { color: var(--leaf); text-decoration: none; }
h1, h2, h3 { font-family: var(--serif); letter-spacing: 0; margin: 0; line-height: 1.05; }
h1 { font-size: clamp(2.4rem, 5vw, 4.8rem); }
h2 { font-size: 2rem; }
h3 { font-size: 1.35rem; }
button, .button {
  border: 0;
  border-radius: 999px;
  background: var(--leaf);
  color: var(--parchment);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  height: 48px;
  white-space: nowrap;
  padding: 0 18px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(63, 95, 60, .2);
}
.button.secondary, button.secondary {
  background: rgba(111, 127, 82, .14);
  color: var(--leaf);
  box-shadow: none;
}
.danger-button, .button.danger {
  background: rgba(128, 45, 35, .12);
  color: #802d23;
  box-shadow: none;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px 22px 14px 24px;
  background: rgba(255, 248, 233, .88);
  color: var(--charcoal);
  padding: 13px 14px;
  font: inherit;
  min-height: 48px;
  min-width: 0;
}
input, select {
  height: 48px;
}
select {
  appearance: auto;
  line-height: 1.2;
}
input[list] {
  text-overflow: ellipsis;
}
textarea { resize: vertical; }
label { font-weight: 700; font-size: .88rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; color: rgba(61, 52, 41, .65); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px clamp(18px, 4vw, 56px);
}
.brand { display: inline-flex; gap: 12px; align-items: center; color: var(--charcoal); }
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 52% 48% 56% 44%;
  background: var(--moss);
  color: var(--parchment);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 700;
}
.brand strong { display: block; font-family: var(--serif); font-size: 1.5rem; }
.brand small { display: block; color: rgba(61, 52, 41, .66); }
.nav { display: grid; gap: 8px; }
.nav a {
  color: var(--charcoal);
  padding: 11px 12px;
  border-radius: 999px;
  font-weight: 700;
}
.nav a.active, .nav a:hover { background: rgba(111, 127, 82, .16); color: var(--leaf); }
.public-nav { display: flex; }
.app-frame { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  border-right: 1px solid var(--line);
  background: rgba(244, 234, 216, .78);
  backdrop-filter: blur(18px);
}
.new-person { padding: 14px; border-radius: 18px 24px 18px 26px; background: var(--bark); color: var(--parchment); font-weight: 800; text-align: center; }
.sidebar-foot { margin-top: auto; display: grid; gap: 8px; color: rgba(61, 52, 41, .7); }
.shell { width: min(1180px, 100%); margin: 0 auto; padding: 28px; }
.public-shell { min-height: calc(100vh - 88px); display: grid; align-items: center; }
.page-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-bottom: 24px; }
.eyebrow { text-transform: uppercase; font-size: .78rem; font-weight: 800; letter-spacing: .12em; color: var(--moss); margin: 0 0 7px; }
.subtle { color: rgba(61, 52, 41, .66); }
.head-actions, .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.panel {
  background: rgba(255, 248, 233, .78);
  border: 1px solid var(--line);
  border-radius: 22px 30px 20px 32px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.panel-header { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.panel-body { padding: 22px; }
.login-panel { max-width: 480px; margin: auto; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, .8fr); gap: clamp(28px, 6vw, 80px); align-items: center; }
.script-line { font-family: var(--script); font-size: clamp(2.2rem, 6vw, 4.5rem); color: var(--bark); margin: 0; }
.hero-copy p:not(.script-line) { max-width: 620px; font-size: 1.13rem; line-height: 1.8; }
.heritage-preview {
  min-height: 470px;
  border-radius: 46% 54% 50% 50%;
  background: linear-gradient(160deg, rgba(217, 223, 196, .9), rgba(255, 248, 233, .78));
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  align-content: center;
  gap: 24px;
  padding: 32px;
}
.preview-row, .branches, .people-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; }
.tree-node {
  padding: 22px 26px;
  min-width: 180px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 48% 52% 48% 52% / 56% 44% 56% 44%;
  background: var(--parchment);
}
.tree-node strong, .tree-node span { display: block; }
.tree-node strong { font-family: var(--serif); font-size: 1.45rem; }
.tree-node span { color: rgba(61, 52, 41, .62); }
.tree-node.sage { background: var(--sage); }
.vine, .living-line {
  width: 4px;
  min-height: 54px;
  border-radius: 999px;
  background: linear-gradient(var(--moss), var(--bark));
}
.tree-toolbar {
  padding: 18px;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.inline-form { display: flex; gap: 12px; align-items: center; min-width: min(440px, 100%); }
.root-picker {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(180px, .36fr) 112px;
  gap: 12px;
  align-items: end;
  width: min(920px, 100%);
}
.root-search-field input { min-width: 0; }
.root-sort-field select { min-width: 180px; }
.share-box { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.share-box input { min-width: min(520px, 100%); }
.tree-canvas {
  padding: clamp(20px, 4vw, 44px);
  border-radius: 44px 56px 38px 52px;
  background: rgba(244, 234, 216, .58);
  border: 1px solid var(--line);
  display: grid;
  justify-items: center;
}
.heritage-chart {
  justify-items: stretch;
  overflow: hidden;
}
.tree-parent-contexts {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.tree-parent-context {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px dashed rgba(110, 76, 52, .28);
  border-radius: 24px 30px 22px 28px;
  background: rgba(255, 248, 233, .5);
}
.tree-parent-context > p {
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
  text-align: center;
}
.parent-context-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.tree-parent-context .tree-person-card {
  width: 168px;
  min-height: 86px;
}
.context-person-with-label {
  display: grid;
  justify-items: center;
  gap: 6px;
}
.context-person-with-label .thread-label {
  margin: 0;
}
.chart-scroll {
  overflow: auto;
  padding: 12px 4px 28px;
}
.descendant-tree,
.descendant-tree ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.descendant-tree {
  display: flex;
  justify-content: center;
  min-width: max-content;
}
.tree-family-node {
  display: grid;
  justify-items: center;
  position: relative;
  padding-top: 12px;
}
.tree-couple-row {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
  gap: 12px;
}
.tree-children {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 16px;
  padding-top: 34px;
}
.tree-children.collapsed {
  display: none;
}
.tree-children::before {
  content: "";
  position: absolute;
  top: 18px;
  left: 50%;
  width: 2px;
  height: 24px;
  background: rgba(110, 76, 52, .32);
}
.child-thread {
  position: relative;
  display: grid;
  align-content: start;
  justify-items: center;
}
.child-thread::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 2px;
  height: 18px;
  background: rgba(110, 76, 52, .32);
}
.child-thread::after {
  content: "";
  position: absolute;
  top: 0;
  left: -12px;
  right: -12px;
  height: 2px;
  background: rgba(110, 76, 52, .28);
}
.child-thread:first-child::after {
  left: 50%;
}
.child-thread:last-child::after {
  right: 50%;
}
.child-thread:only-child::after {
  display: none;
}
.thread-label {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  align-self: start;
  width: max-content;
  max-width: 100%;
  min-height: 22px;
  margin-top: 14px;
  margin-bottom: 8px;
  border-radius: 999px;
  background: rgba(110, 76, 52, .1);
  color: var(--bark);
  font-size: .72rem;
  font-weight: 800;
  line-height: 1;
  padding: 4px 9px;
  white-space: nowrap;
}
.thread-node-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: center;
}
.tree-branch-toggle {
  min-height: 28px;
  height: 28px;
  margin-top: 10px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(111, 127, 82, .12);
  color: var(--leaf);
  box-shadow: none;
  font-size: .75rem;
}
.tree-person-card {
  position: relative;
  width: 178px;
  min-height: 96px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 18px 24px 17px 26px;
  background: rgba(255, 248, 233, .94);
  box-shadow: 0 12px 28px rgba(61, 52, 41, .1);
  color: var(--charcoal);
  padding: 10px;
  cursor: pointer;
}
.tree-person-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(61, 52, 41, .14);
}
.tree-card-hit {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}
.tree-person-card .profile-link {
  position: relative;
  z-index: 2;
  width: fit-content;
}
.tree-person-card.root-card {
  box-shadow: 0 0 0 3px rgba(111, 127, 82, .14), 0 16px 34px rgba(61, 52, 41, .12);
}
.tree-person-card.gender-male {
  background: linear-gradient(145deg, rgba(216, 226, 208, .95), rgba(255, 248, 233, .92));
  border-color: rgba(63, 95, 60, .28);
}
.tree-person-card.gender-female {
  background: linear-gradient(145deg, rgba(241, 222, 209, .95), rgba(255, 248, 233, .92));
  border-color: rgba(137, 83, 63, .25);
}
.tree-person-card.gender-other {
  background: linear-gradient(145deg, rgba(234, 223, 189, .95), rgba(255, 248, 233, .92));
}
.tree-person-card .portrait {
  width: 34px;
  height: 34px;
  font-size: .9rem;
}
.tree-person-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}
.tree-person-copy h3 {
  font-family: var(--sans);
  font-size: .86rem;
  line-height: 1.25;
}
.tree-person-copy p {
  margin: 0;
  color: rgba(61, 52, 41, .62);
  font-size: .74rem;
}
.marriage-knot {
  align-self: center;
  display: grid;
  place-items: center;
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: rgba(110, 76, 52, .38);
}
.marriage-knot span {
  transform: translateY(-18px);
  border-radius: 999px;
  background: rgba(244, 234, 216, .95);
  color: rgba(61, 52, 41, .62);
  font-size: .66rem;
  font-weight: 800;
  padding: 2px 6px;
  white-space: nowrap;
}
.person-leaf, .person-card {
  position: relative;
  background: rgba(255, 248, 233, .92);
  border: 1px solid var(--line);
  border-radius: 34px 42px 30px 46px;
  padding: 18px;
  box-shadow: 0 12px 30px rgba(61, 52, 41, .1);
  color: var(--charcoal);
}
.person-leaf {
  width: min(360px, 100%);
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 14px;
  align-items: center;
}
.person-leaf.primary { background: #f7f0d8; }
.person-leaf.gender-male, .person-card.gender-male, .profile-panel.gender-male {
  background: linear-gradient(145deg, rgba(216, 226, 208, .95), rgba(255, 248, 233, .9));
  border-color: rgba(63, 95, 60, .28);
}
.person-leaf.gender-female, .person-card.gender-female, .profile-panel.gender-female {
  background: linear-gradient(145deg, rgba(241, 222, 209, .95), rgba(255, 248, 233, .9));
  border-color: rgba(137, 83, 63, .25);
}
.person-leaf.gender-other, .person-card.gender-other, .profile-panel.gender-other {
  background: linear-gradient(145deg, rgba(234, 223, 189, .95), rgba(255, 248, 233, .9));
}
.gender-male .portrait { background: var(--male-tint); color: #3f5f3c; }
.gender-female .portrait { background: var(--female-tint); color: #89533f; }
.gender-other .portrait { background: var(--other-tint); color: var(--bark); }
.root-leaf { width: min(460px, 100%); }
.portrait {
  width: 62px;
  height: 62px;
  border-radius: 50% 46% 52% 48%;
  background: var(--sage);
  color: var(--leaf);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 800;
  overflow: hidden;
}
.portrait.large { width: 128px; height: 128px; font-size: 2.8rem; margin-bottom: 18px; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.relation-badge {
  position: absolute;
  top: -10px;
  left: 20px;
  background: var(--moss);
  color: var(--parchment);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: .78rem;
  font-weight: 800;
}
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field { display: grid; gap: 8px; }
.full { grid-column: 1 / -1; }
.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.relationship-form.compact { grid-template-columns: repeat(2, minmax(260px, 1fr)); }
.relationship-type-field { grid-column: 1 / -1; max-width: 360px; }
.parchment { background: rgba(244, 234, 216, .42); }
.people-grid { padding: 20px; }
.person-card { display: grid; gap: 9px; }
.person-card small, .person-card span { color: rgba(61, 52, 41, .65); }
.people-explorer {
  display: grid;
  grid-template-columns: minmax(240px, var(--explorer-width, 320px)) 10px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.explorer-resizer {
  align-self: stretch;
  min-height: 520px;
  border-radius: 999px;
  cursor: col-resize;
  background: linear-gradient(90deg, transparent, rgba(111, 127, 82, .18), transparent);
}
.explorer-resizer:hover,
.people-explorer.resizing .explorer-resizer {
  background: rgba(111, 127, 82, .28);
}
.explorer-nav {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  min-width: 0;
}
.explorer-tree {
  max-height: calc(100vh - 132px);
  overflow: auto;
  padding: 12px;
}
.explorer-tree ul {
  list-style: none;
  margin: 0;
  padding-left: 16px;
}
.explorer-tree > ul { padding-left: 0; }
.explorer-tree li { margin: 6px 0; }
.explorer-node-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 4px;
  align-items: start;
}
.tree-toggle,
.tree-toggle-spacer {
  width: 24px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 50%;
  box-shadow: none;
  background: rgba(111, 127, 82, .12);
  color: var(--leaf);
  font-size: .82rem;
  line-height: 1;
}
.tree-toggle-spacer { display: block; background: transparent; }
.explorer-children.collapsed { display: none; }
.explorer-tree a {
  display: grid;
  gap: 3px;
  border-radius: 14px 20px 14px 22px;
  color: var(--charcoal);
  padding: 10px 12px;
}
.explorer-tree a:hover, .explorer-tree a.active {
  background: rgba(111, 127, 82, .16);
  color: var(--leaf);
}
.explorer-tree strong {
  font-size: .95rem;
  line-height: 1.25;
}
.explorer-tree span {
  color: rgba(61, 52, 41, .6);
  font-size: .78rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.people-explorer.compact {
  --explorer-width: 360px;
}
.people-explorer.compact .explorer-tree {
  padding: 8px;
}
.people-explorer.compact .explorer-tree li {
  margin: 2px 0;
}
.people-explorer.compact .explorer-tree a {
  padding: 6px 8px;
  border-radius: 10px 14px 10px 16px;
}
.people-explorer.compact .explorer-tree strong {
  font-size: .84rem;
}
.people-explorer.compact .explorer-tree span {
  display: none;
}
.people-explorer.compact .tree-toggle,
.people-explorer.compact .tree-toggle-spacer {
  height: 24px;
  min-height: 24px;
}
.people-explorer.compact .person-card {
  padding: 14px;
  gap: 6px;
}
.people-explorer.compact .portrait {
  width: 48px;
  height: 48px;
  font-size: 1.1rem;
}
.explorer-main { min-width: 0; }
.explorer-tools { align-items: flex-end; }
.explorer-context { padding: 20px; }
.context-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 16px;
}
.explorer-people {
  padding: 0;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.context-callout {
  border: 1px solid rgba(111, 127, 82, .26);
  border-radius: 18px 24px 18px 26px;
  background: rgba(217, 223, 196, .34);
  padding: 16px;
}
.context-callout p {
  margin: 0;
  color: rgba(61, 52, 41, .72);
}
.surname-chip {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  border-radius: 999px;
  background: rgba(110, 76, 52, .1);
  color: var(--bark);
  padding: 4px 10px;
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.2;
}
.large-chip { margin: 8px 0 4px; font-size: .9rem; }
.picker-summary {
  display: block;
  border-left: 3px solid rgba(111, 127, 82, .4);
  color: rgba(61, 52, 41, .72);
  font-size: .78rem;
  line-height: 1.45;
  padding-left: 9px;
}
.picker-summary.muted {
  border-left-color: rgba(110, 76, 52, .18);
  color: rgba(61, 52, 41, .52);
}
.detail-grid { display: grid; grid-template-columns: minmax(260px, .75fr) minmax(0, 1.35fr); gap: 20px; align-items: start; }
.person-detail-grid {
  grid-template-columns: 1fr;
}
.person-detail-grid .profile-panel .panel-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.person-detail-grid .portrait.large {
  margin-bottom: 0;
}
.person-detail-grid .profile-panel .story-note {
  grid-column: 1 / -1;
}
.facts { display: grid; gap: 14px; margin: 0; }
.facts div { display: grid; gap: 4px; }
.facts dt { font-weight: 800; color: var(--moss); }
.facts dd { margin: 0; }
.story-note, .story-public {
  margin-top: 20px;
  font-family: "Playfair Display", var(--serif);
  font-style: italic;
  line-height: 1.8;
}
.relationship-list { display: grid; }
.relationship-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.icon-danger {
  min-height: 34px;
  width: 34px;
  padding: 0;
  background: rgba(128, 45, 35, .1);
  color: #802d23;
  box-shadow: none;
}
.check-field { display: flex; gap: 10px; align-items: center; }
.check-field input { width: auto; }
.search-form { display: flex; gap: 10px; width: 100%; }
.people-search {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(160px, .28fr) minmax(100px, auto);
  gap: 12px;
  align-items: end;
  width: 100%;
}
.people-search select,
.people-search input,
.people-search button {
  height: 48px;
  min-height: 48px;
}
.table-wrap { overflow: auto; }
.empty, .empty-state { padding: 28px; color: rgba(61, 52, 41, .66); }
.alert { margin-bottom: 16px; border-radius: 18px; padding: 13px 16px; font-weight: 700; }
.alert.success { background: rgba(111, 127, 82, .16); color: var(--leaf); }
.alert.error { background: rgba(128, 45, 35, .12); color: #802d23; }
.share-head { text-align: center; padding: 42px 20px 20px; }
.public-tree { margin: 0 auto 24px; max-width: 1100px; }
.vocabulary-grid { grid-template-columns: minmax(560px, 1fr) minmax(340px, 420px); }
.vocabulary-grid table { min-width: 620px; }
.vocabulary-grid .panel-body { padding: 20px; }
.vocabulary-grid .form-grid { grid-template-columns: 1fr; }
.vocabulary-grid .check-field { min-height: 48px; align-self: end; }
.tree-empty {
  margin-top: 24px;
  max-width: 520px;
  text-align: center;
  color: rgba(61, 52, 41, .7);
}
.tree-empty p { line-height: 1.7; }

@media (max-width: 900px) {
  .app-frame { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .sidebar .nav { grid-auto-flow: column; overflow-x: auto; }
  .sidebar-foot { margin-top: 0; margin-left: auto; }
  .hero, .detail-grid { grid-template-columns: 1fr; }
  .people-explorer { grid-template-columns: 1fr; }
  .explorer-resizer { display: none; }
  .explorer-nav { position: static; max-height: none; }
  .explorer-tree { max-height: 360px; }
  .page-head, .tree-toolbar { align-items: stretch; flex-direction: column; }
  .vocabulary-grid { grid-template-columns: 1fr; }
  .compact, .form-grid { grid-template-columns: 1fr; }
  .relationship-type-field { max-width: none; }
  .tree-couple-row {
    gap: 8px;
  }
  .tree-person-card {
    width: 170px;
  }
}

@media (max-width: 560px) {
  .shell { padding: 18px; }
  .topbar { padding: 16px; }
  .sidebar { padding: 16px; }
  .sidebar .brand { width: 100%; }
  .public-nav { margin-left: auto; }
  .heritage-preview { min-height: 360px; padding: 20px; }
  .relationship-row { grid-template-columns: 1fr; }
  .context-head { align-items: stretch; flex-direction: column; }
  .inline-form, .search-form { flex-direction: column; align-items: stretch; }
  .root-picker, .people-search { grid-template-columns: 1fr; }
  .person-detail-grid .profile-panel .panel-body { grid-template-columns: 1fr; }
  .person-detail-grid .portrait.large { margin-bottom: 6px; }
  .person-leaf { grid-template-columns: 56px 1fr; }
  .portrait { width: 52px; height: 52px; }
  .tree-couple-row {
    flex-direction: column;
    align-items: center;
  }
  .marriage-knot {
    width: 2px;
    height: 18px;
  }
  .tree-children {
    gap: 14px;
  }
  .tree-person-card {
    width: 160px;
    grid-template-columns: 44px minmax(0, 1fr);
  }
}
