/* Atlante di famiglia. Composizioni autonome: lista tascabile, ramo su tablet,
   tavolo genealogico su desktop. Nessun asset o font di terze parti. */
body.con-barra #app[data-schermata='albero'] { max-width: 1760px; }
.family-atlas { --atlas-paper: #fffdf8; --atlas-forest: #244e40; --atlas-muted: #53645d; min-width: 0; }
.family-atlas *, .atlas-dialog * { box-sizing: border-box; }
.family-atlas [hidden], .atlas-dialog [hidden] { display: none !important; }
.family-atlas h2, .family-atlas h3, .atlas-dialog h2, .atlas-dialog h3 { margin: 0; line-height: 1.25; letter-spacing: -.025em; }
.family-atlas p, .atlas-dialog p { overflow-wrap: anywhere; }
.family-atlas button, .family-atlas a, .family-atlas input, .family-atlas select, .family-atlas summary { -webkit-tap-highlight-color: transparent; }
.family-atlas :focus-visible, .atlas-dialog :focus-visible { outline: 3px solid var(--blu); outline-offset: 4px; }
.atlas-hero { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 130px; align-items: center; gap: 24px; overflow: hidden; padding: 24px 30px; border: 1px solid #d4dfcf; border-radius: 24px; background: #e9eee2; }
.atlas-hero-copy { position: relative; z-index: 1; }
.atlas-eyebrow { font-size: .85rem; font-weight: 700; letter-spacing: .1em; margin: 0 0 14px; color: #52644b; }
.atlas-hero h2 { margin: 0; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(1.6rem, 2.5vw, 2.2rem); font-weight: 400; line-height: 1.14; letter-spacing: -.045em; }
.atlas-hero h2 br { display: none; }
.atlas-hero h2 em { color: #396d4b; font-weight: 400; }
.atlas-intro { margin: 10px 0 14px; max-width: 64ch; color: #465b4c; font-size: .85rem; line-height: 1.5; }
.atlas-hero .atlas-eyebrow { display: none; }
.atlas-stats { display: flex; flex-wrap: wrap; gap: 12px 28px; font-size: .85rem; color: #465b4c; }
.atlas-stats strong { font-size: 1.15rem; margin-right: 4px; color: #244e40; }
.atlas-hero-art { display: grid; place-items: center; width: 110px; height: 110px; border: 1px solid #b3c8ad; border-radius: 50%; box-shadow: 0 0 0 20px #dce5d655, 0 0 0 40px #dce5d655; color: #4d7350; transform: rotate(-7deg); }
.atlas-hero-art .ui-icon { width: 74px; height: 74px; stroke-width: 1; }
.atlas-top-actions { display: flex; align-items: start; flex-wrap: wrap; gap: 12px; margin: 16px 0 20px; }
.atlas-manage { margin-left: auto; min-width: 0; }
.atlas-manage summary, .atlas-extra-filters summary { cursor: pointer; min-height: 56px; padding: 14px 4px; color: #244e40; font-size: .85rem; font-weight: 600; }
.atlas-manage > div { display: grid; gap: 8px; padding-block: 8px; }
.atlas-extra-filters { min-width: 0; }
.atlas-extra-fields { display: grid; gap: 12px; padding-top: 12px; }
.atlas-button, .atlas-tab, .atlas-text-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 56px; padding: 12px 18px; border: 1px solid #c9d4c7; border-radius: 12px; color: #244e40; background: #fff; text-decoration: none; font: 600 .85rem/1.35 inherit; font-family: inherit; font-size: .85rem; line-height: 1.35; cursor: pointer; max-width: 100%; overflow-wrap: anywhere; text-align: center; }
.atlas-button:hover, .atlas-person:hover { background: #f0f5eb; border-color: #91ac8d; }
.atlas-primary { background: #244e40; border-color: #244e40; color: white; }
.atlas-primary:hover { background: #173f35; color: white; }
.atlas-button[aria-pressed='true'] { background: #f5e5ca; border-color: #b89961; color: #594422; }
.atlas-text-link { color: #52644b; font-size: .85rem; text-underline-offset: 4px; padding: 14px 4px; min-height: 56px; display: inline-flex; align-items: center; }
.atlas-top-actions > .atlas-text-link { margin-left: auto; }
.atlas-controls { display: grid; gap: 20px; padding: 20px; background: white; border: 1px solid var(--linea); border-radius: 20px; }
.atlas-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 5px; gap: 8px; border-radius: 14px; background: #eff2eb; width: min(100%, 780px); }
.atlas-tab { border-color: transparent; background: transparent; font-weight: 650; }
.atlas-tab[aria-selected='true'] { color: white; background: #244e40; box-shadow: 0 2px 5px #203b3412; }
.atlas-filters { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(150px, .55fr); align-items: end; gap: 16px; }
.atlas-filters label, .atlas-form-fields label { display: grid; gap: 8px; min-width: 0; font-size: .85rem; font-weight: 600; }
.atlas-search-field { position: relative; display: block; min-width: 0; }
.atlas-search-field .ui-icon { position: absolute; left: 14px; top: 16px; width: 24px; height: 24px; pointer-events: none; color: #53645d; }
.atlas-search input, .atlas-filters select, .atlas-link-form select, .atlas-link-form input, .atlas-link-form textarea, .atlas-connection-filters input, .atlas-connection-filters select { width: 100%; min-width: 0; min-height: 56px; font: inherit; font-size: .85rem; line-height: 1.4; color: #203b34; background: #fff; border: 1px solid #aabca7; border-radius: 10px; padding: 12px; }
.atlas-link-form textarea { resize: vertical; }
.atlas-link-preview { background: #eaf0e4; border-left: 3px solid #739b61; border-radius: 8px; padding: 14px; font-size: .85rem; line-height: 1.5; }
.atlas-connections { background: #fffdf8; border: 1px solid #d1ddc9; border-radius: 20px; padding: 24px; }
.atlas-connection-filters { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .7fr); gap: 16px; margin: 24px 0 12px; }
.atlas-connection-filters label { display: grid; align-content: start; gap: 8px; font-size: .85rem; font-weight: 600; min-width: 0; }
.atlas-connection-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr)); gap: 14px; }
.atlas-connection-list .atlas-link-row { margin: 0; padding: 20px; border: 1px solid #d6dfcf; border-radius: 14px; background: white; }
.atlas-connection-list .atlas-link-row.proposed { border-style: dashed; background: #fffbf2; }
.atlas-link-names { font-weight: 600; }
.atlas-link-row .atlas-link-note { color: #53645d; font-size: .85rem; white-space: pre-wrap; }
.atlas-search input { padding-left: 46px; }
.atlas-filters .atlas-check { display: flex; align-items: center; gap: 10px; min-height: 56px; line-height: 1.35; }
.atlas-check input { width: 24px; height: 24px; flex: 0 0 auto; accent-color: #244e40; }
.atlas-result { font-size: .85rem; color: #53645d; margin: 20px 2px 14px; }
.atlas-notice:empty { display: none; }
.atlas-notice:not(:empty) { background: #f8edd6; border-left: 4px solid #b98a2f; padding: 16px 20px; border-radius: 8px; font-size: .95rem; }
.atlas-workspace { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 24px; }
.atlas-workspace > *, .atlas-content { min-width: 0; }
.atlas-generations { display: grid; gap: 24px; }
.atlas-generation { position: relative; border: 1px solid #d6dfcf; background: #fffdf8; border-radius: 20px; padding: 12px 20px 20px; }
.atlas-generation .gen-titolo { display: flex; align-items: center; gap: 12px; border: 0; padding: 0; margin: 0 0 12px; }
.atlas-generation-toggle { border: 0; background: none; text-align: left; color: #244e40; min-height: 56px; padding: 4px 0; font-size: 1rem; font-weight: 650; flex: 1; display: flex; align-items: center; gap: 12px; }
.atlas-generation-toggle::before { content: '−'; font-weight: 400; font-size: 1.2rem; }
.atlas-generation-toggle[aria-expanded='false']::before { content: '+'; }
.atlas-count { display: grid; place-items: center; border: 1px solid #d5dfcc; border-radius: 50%; font-size: .85rem; width: 36px; height: 36px; flex: 0 0 auto; }
.atlas-generation-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 12px; }
.atlas-person { display: flex; align-items: center; gap: 14px; min-width: 0; width: 100%; padding: 16px; min-height: 104px; border: 1px solid #d6dfd0; border-radius: 14px; background: #fff; color: #203b34; text-align: left; line-height: 1.3; cursor: pointer; }
.atlas-portrait { display: inline-grid; place-items: center; width: 52px; height: 52px; flex: 0 0 auto; border-radius: 50%; background: var(--portrait, #396d4b); color: white; font-size: 1rem; letter-spacing: -.03em; font-weight: 600; overflow: hidden; }
.atlas-portrait img { width: 100%; height: 100%; object-fit: cover; }
.atlas-person-copy { display: grid; gap: 5px; min-width: 0; }
.atlas-person strong { font-size: 1rem; line-height: 1.3; overflow-wrap: anywhere; font-weight: 650; }
.atlas-relation, .atlas-person-meta { font-size: .85rem; font-weight: 400; color: #53645d; overflow-wrap: anywhere; }
.atlas-person-meta { color: #416537; }
.atlas-person.is-selected { border: 2px solid #396d4b; padding: 15px; background: #edf3e7; box-shadow: 0 0 0 3px #d5e1ce80; }
.atlas-person.is-proposed { border-style: dashed; border-color: #9e7735; background: #fffbf2; }
.atlas-person.is-proposed .atlas-person-meta { color: #7e5a12; }
.atlas-inspector { padding: 24px; border: 1px solid #d1dccb; background: #fffdf8; border-radius: 22px; min-width: 0; overflow-wrap: anywhere; }
.atlas-detail-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.atlas-detail-heading .atlas-eyebrow { margin: 0; }
.atlas-detail-heading .atlas-close { display: none; }
.atlas-identity { text-align: center; }
.atlas-identity .atlas-portrait { width: 80px; height: 80px; font-size: 1.7rem; margin: 12px 0 18px; box-shadow: 0 0 0 7px #eaf0e4; }
.atlas-identity h2 { font-family: Georgia, serif; font-size: 1.55rem; font-weight: 400; }
.atlas-detail-relation, .atlas-dates { font-size: .85rem; color: #53645d; line-height: 1.5; margin: 10px 0; }
.atlas-group-badge { text-align: center; background: #eaf0e4; border-radius: 10px; padding: 12px; font-size: .85rem; color: #465d3e; line-height: 1.4; }
.atlas-detail-actions { display: grid; gap: 10px; margin: 20px 0 28px; }
.atlas-links-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; justify-content: space-between; padding-top: 22px; border-top: 1px solid #d6dfcf; }
.atlas-links-heading h3 { font-size: 1rem; }
.atlas-links-heading .atlas-button { padding: 12px; }
.atlas-link-row { border-top: 1px solid #e0e5d9; padding: 18px 0 12px; margin-top: 12px; }
.atlas-link-row p { margin: 0 0 10px; line-height: 1.5; font-size: .95rem; }
.atlas-link-row .atlas-link-kind { color: #53645d; font-size: .85rem; }
.atlas-link-row.proposed { border: 1px dashed #a98445; border-radius: 12px; padding: 14px; background: #fffbf2; }
.atlas-link-row.rejected { opacity: .85; }
.atlas-link-actions { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.atlas-text-button { padding: 8px 4px; border: 0; background: none; text-decoration: underline; text-underline-offset: 4px; }
.atlas-danger { color: #8f3e2b; }
.atlas-removed summary, .atlas-history summary { cursor: pointer; min-height: 56px; padding: 16px 0; font-size: .95rem; font-weight: 600; }
.atlas-removed { border-top: 1px solid #d6dfcf; margin-top: 20px; }
.atlas-form-fields { display: grid; gap: 20px; margin: 24px 0; }
.atlas-link-form > .atlas-button { width: 100%; margin-top: 10px; }
.atlas-form-error { color: #8f3e2b; font-size: .9rem; line-height: 1.5; }
.atlas-form-error:empty { display: none; }
.atlas-confirm { border-radius: 12px; padding: 16px; background: #f8edd6; margin-top: 12px; }
.atlas-confirm .atlas-button { width: 100%; margin-top: 10px; }
.atlas-view-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.atlas-view-heading h2 { font-size: 1.25rem; }
.atlas-view-heading .atlas-eyebrow { margin-bottom: 8px; }
.atlas-branch { border: 1px solid #d6dfcf; border-radius: 22px; background: #fffdf8; padding: 28px; }
.atlas-branch > .atlas-view-heading { border-bottom: 1px solid #d6dfcf; padding-bottom: 24px; margin-bottom: 28px; }
.atlas-branch-section { margin: 24px 0; min-width: 0; }
.atlas-branch-section h3 { font-size: .85rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 650; color: #53645d; margin: 0 0 14px; }
.atlas-branch-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 12px; }
.atlas-branch-center { position: relative; display: grid; align-items: center; gap: 24px; padding: 30px 0; border-top: 1px solid #cbd9c3; border-bottom: 1px solid #cbd9c3; }
.atlas-branch-center::before, .atlas-branch-center::after { content: ''; position: absolute; left: 28px; width: 2px; height: 28px; background: #9cb58f; }
.atlas-branch-center::before { top: 0; }
.atlas-branch-center::after { bottom: 0; }
.atlas-branch-center > .atlas-branch-section { margin: 0; }
.atlas-focus-person { background: #e7efdf; border-color: #739b61; min-height: 136px; }
.atlas-focus-person .atlas-portrait { width: 64px; height: 64px; font-size: 1.3rem; }
.atlas-focus-person strong { font-family: Georgia, serif; font-size: 1.4rem; font-weight: 400; }
.atlas-branch-empty { border: 1px dashed #bdcdb5; border-radius: 12px; padding: 20px; font-size: .9rem; color: #53645d; background: #f3f5ef; }
.atlas-hint { font-size: .85rem; line-height: 1.6; color: #53645d; }
.atlas-map { border: 1px solid #d1ddc9; background: #fffdf8; border-radius: 20px; overflow: hidden; }
.atlas-map > .atlas-view-heading { padding: 20px; }
.atlas-legend { display: flex; flex-wrap: wrap; gap: 12px 20px; font-size: .85rem; }
.atlas-legend span { display: inline-flex; align-items: center; gap: 8px; }
.atlas-legend span::before { content: ''; display: inline-block; width: 20px; border-top: 2px solid #758e67; }
.atlas-legend .partner::before { border-color: #b0784a; }
.atlas-legend .relation::before { border-color: #82699d; border-top-style: dotted; }
.atlas-legend .proposed::before { border-top-style: dashed; border-color: #947029; }
.atlas-map-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-block: 1px solid #dae1d1; background: #f3f5ee; padding: 12px 16px; }
.atlas-map-controls output { min-width: 52px; text-align: center; font-size: .85rem; }
.atlas-map-controls .atlas-button { min-width: 56px; padding: 10px 12px; }
.atlas-map-viewport { position: relative; overflow: auto; height: min(640px, 70vh); min-height: 360px; overscroll-behavior-x: contain; background-color: #f7f8f2; background-image: radial-gradient(#ccd7c4 1px, transparent 1px); background-size: 22px 22px; scrollbar-color: #a1b394 #edf2e8; scrollbar-width: auto; }
.atlas-map-surface { position: relative; transform-origin: top left; }
.atlas-map-scaled { position: relative; overflow: hidden; }
.atlas-map-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.atlas-map-lines path { fill: none; stroke: #9cb08f; stroke-width: 2; stroke-linejoin: round; }
.atlas-map-lines .partner { stroke: #b28562; }
.atlas-map-lines .relation { stroke: #82699d; stroke-dasharray: 3 4; }
.atlas-map-lines .highlight { stroke: #365e29; stroke-width: 3; }
.atlas-map-lines .partner.highlight { stroke: #9b6336; }
.atlas-map-lines .relation.highlight { stroke: #69428d; }
.atlas-map-lines .proposed { stroke-dasharray: 6 5; stroke: #947029; }
.atlas-map-person { position: absolute; width: 204px; height: 140px; min-height: 0; padding: 14px; flex-direction: row; align-items: start; gap: 10px; box-shadow: 0 4px 12px #203b3408; overflow: hidden; }
.atlas-map-person.is-selected { padding: 13px; }
.atlas-map-person .atlas-portrait { width: 38px; height: 38px; font-size: .85rem; }
.atlas-map-person .atlas-person-copy { display: flex; flex-direction: column; height: 100%; gap: 5px; }
.atlas-map-person strong { font-size: .85rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.atlas-map-person .atlas-relation { display: none; }
.atlas-map-person .atlas-person-meta { font-size: .85rem; margin-top: auto; }
.atlas-map-label { position: absolute; left: 30px; color: #536a48; font-size: .85rem; margin: 0; background: #f7f8f2; padding: 6px 10px; border-radius: 8px; }
.atlas-map.is-expanded .atlas-map-viewport { height: min(1080px, 85dvh); }
.atlas-map-matches { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 20px; }
.atlas-map-person.is-dimmed { opacity: .35; }
.atlas-map-person.is-match { box-shadow: 0 0 0 6px #c8943d; }
.atlas-workspace.is-overview { grid-template-columns: minmax(0, 1fr); }
.is-overview .atlas-detail-host { position: static; }
.is-overview .atlas-inspector { max-height: none; }
.atlas-map > .atlas-hint { padding: 0 20px; margin: 16px 0; }
.atlas-empty { min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px; text-align: center; border: 1px dashed #b6c8aa; border-radius: 22px; background: #fffdf8; }
.atlas-empty .ui-icon { width: 44px; height: 44px; margin-bottom: 20px; }
.atlas-empty h2 { font-family: Georgia, serif; font-size: 1.7rem; font-weight: 400; }
.atlas-footer { margin-top: 30px; border-top: 1px solid #d5dfcc; padding-top: 12px; font-size: .85rem; color: #53645d; line-height: 1.6; }
.atlas-history-item { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 16px 0; border-top: 1px solid #d5dfcc; }
.atlas-history-item > div { min-width: 0; overflow-wrap: anywhere; }
.atlas-history-item small { display: block; font-size: .85rem; font-weight: 400; }
.atlas-dialog { padding: 0; border: 0; border-radius: 22px; color: #203b34; background: #fffdf8; max-width: min(620px, calc(100vw - 24px)); width: 100%; max-height: calc(100dvh - 24px); overscroll-behavior: contain; }
.atlas-dialog::backdrop { background: #142d23a8; backdrop-filter: blur(3px); }
.atlas-dialog .atlas-inspector { border: 0; }
.atlas-dialog .atlas-close { display: inline-flex; }
body:has(.atlas-dialog[open]) { overflow: hidden; }

@media (min-width: 700px) and (max-width: 1199px) {
  body.con-barra #app[data-schermata='albero'] { padding-inline: 24px; }
  .atlas-hero { padding: 24px; grid-template-columns: minmax(0, 1fr) 110px; }
  .atlas-filters { grid-template-columns: minmax(0, 1fr) minmax(0, .75fr); }
  .atlas-check { grid-column: 1 / -1; }
  .atlas-branch-center { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .atlas-inspector { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 28px; }
  .atlas-inspector > .atlas-detail-heading, .atlas-inspector > .atlas-links-heading, .atlas-inspector > .atlas-link-form, .atlas-inspector > .atlas-removed { grid-column: 1 / -1; }
  .atlas-identity { grid-row: span 3; align-self: center; }
  .atlas-link-form .atlas-form-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (min-width: 1200px) {
  .atlas-workspace { grid-template-columns: minmax(0, 1fr) minmax(285px, 330px); }
  .atlas-detail-host { position: sticky; top: 24px; }
  .atlas-inspector { max-height: calc(100dvh - 48px); overflow: auto; scrollbar-width: thin; }
  .atlas-controls { grid-template-columns: minmax(0, 1fr); }
}
@media (min-width: 1600px) {
  .atlas-hero { grid-template-columns: minmax(0, 1fr) 170px; }
  .atlas-workspace { grid-template-columns: minmax(0, 1fr) 360px; }
  .atlas-branch-center { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 699px) {
  body.con-barra #app[data-schermata='albero'] { padding-inline: 14px; }
  [data-schermata='albero'] .testata { margin-bottom: 20px; }
  .atlas-hero { padding: 18px 20px; border-radius: 20px; display: block; }
  .atlas-hero h2 { font-size: 1.5rem; line-height: 1.12; }
  .atlas-hero-art { position: absolute; right: -74px; bottom: -80px; width: 210px; height: 210px; opacity: .18; }
  .atlas-eyebrow { font-size: .85rem; letter-spacing: .04em; }
  .atlas-intro { display: none; }
  .atlas-stats { margin-top: 14px; }
  .atlas-stats { gap: 6px 18px; }
  .atlas-top-actions { gap: 10px; margin: 14px 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr); }
  .atlas-top-actions > .atlas-button { width: 100%; padding: 12px; }
  .atlas-top-actions > .atlas-button .ui-icon { display: none; }
  .atlas-manage { margin: 0; }
  .atlas-manage summary { padding: 12px 2px; }
  .atlas-top-actions > .atlas-text-link { margin: 0; }
  .atlas-controls { padding: 12px; border-radius: 16px; gap: 18px; }
  .atlas-tabs { gap: 8px; padding: 4px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .atlas-tab { padding: 10px 3px; font-size: .85rem; letter-spacing: -.025em; }
  .atlas-filters { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .atlas-extra-filters summary { padding-block: 12px; }
  .atlas-filters .atlas-check { min-height: 56px; }
  .atlas-detail-host { display: none; }
  .atlas-generations { gap: 20px; }
  .atlas-generation { padding: 8px 12px 12px; border-radius: 16px; }
  .atlas-generation-toggle { font-size: .95rem; }
  .atlas-generation-cards { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .atlas-person { min-height: 100px; padding: 14px 12px; gap: 12px; }
  .atlas-person.is-selected { padding: 13px 11px; }
  .atlas-person strong { font-size: .95rem; }
  .atlas-portrait { width: 48px; height: 48px; font-size: .95rem; }
  .atlas-branch { padding: 20px 16px; border-radius: 16px; }
  .atlas-branch-center { padding-block: 28px; }
  .atlas-focus-person strong { font-size: 1.15rem; }
  .atlas-branch-cards { grid-template-columns: minmax(0, 1fr); }
  .atlas-map > .atlas-view-heading { padding: 16px; }
  .atlas-map-controls { padding: 10px; }
  .atlas-map-controls .atlas-button { font-size: .85rem; }
  .atlas-map-viewport { height: 480px; }
  .atlas-connections { padding: 20px 14px; }
  .atlas-connection-filters { grid-template-columns: minmax(0, 1fr); }
  .atlas-map-person { padding: 14px; }
  .atlas-map-person.is-selected { padding: 13px; }
  .atlas-map-person strong { font-size: .85rem; }
  .atlas-dialog { margin: auto auto 0; border-radius: 24px 24px 0 0; max-width: 100vw; max-height: 92dvh; }
  .atlas-dialog .atlas-inspector { padding: 20px 20px max(24px, env(safe-area-inset-bottom)); }
  .atlas-dialog .atlas-detail-heading { position: sticky; top: 0; z-index: 1; padding-block: 8px; background: #fffdf8; }
  .atlas-history-item { align-items: start; flex-direction: column; gap: 10px; }
}
@media (min-width: 1200px) {
  .is-overview .atlas-inspector { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 28px; }
  .is-overview .atlas-inspector > .atlas-detail-heading, .is-overview .atlas-inspector > .atlas-links-heading, .is-overview .atlas-inspector > .atlas-link-form, .is-overview .atlas-inspector > .atlas-removed { grid-column: 1 / -1; }
  .is-overview .atlas-link-form .atlas-form-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .family-atlas *, .atlas-dialog * { scroll-behavior: auto !important; transition: none !important; } }

/* Genealogia vera: l'ascendenza è indipendente dai gruppi di visualizzazione. */
.atlas-genealogy { padding: 24px; }
.pedigree-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 24px; }
.pedigree-choices label, .pedigree-mode { display: grid; gap: 8px; min-width: 0; font-size: .85rem; font-weight: 600; }
.pedigree-choices select, .pedigree-mode select { width: 100%; min-width: 0; min-height: 56px; padding: 12px; font: inherit; color: #203b34; background: white; border: 1px solid #aabca7; border-radius: 10px; }
.pedigree { min-width: 0; margin: 24px 0; }
.pedigree-mode { max-width: 420px; margin-bottom: 20px; }
.pedigree-diagram { border: 1px solid #ccd8c5; border-radius: 16px; overflow: hidden; }
.pedigree-zoom { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 12px; background: #edf1e7; }
.pedigree-zoom .atlas-button { min-height: 48px; padding: 10px 12px; font-size: var(--t-xs); }
.pedigree-zoom output { min-width: 48px; font-size: var(--t-xs); text-align: center; }
.pedigree-viewport { position: relative; overflow: auto; min-height: 360px; height: min(720px, 76dvh); overscroll-behavior-x: contain; scrollbar-color: #9eb596 #eef3e9; background-color: #f7f8f2; background-image: radial-gradient(#ccd7c4 1px, transparent 1px); background-size: 22px 22px; }
.pedigree-scaled { position: relative; overflow: hidden; margin-inline: auto; }
.pedigree-surface { position: relative; transform-origin: top left; }
.pedigree-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.pedigree-lines path { fill: none; stroke: #6f8070; stroke-width: 2; }
.pedigree-lines .father { stroke: #3f7269; }
.pedigree-lines .mother { stroke: #af7751; }
.pedigree-lines .uncertain { stroke-dasharray: 5 5; opacity: .65; }
.pedigree-node { --branch-color: #798a71; display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 14px; background: #fffdf8; border: 1px solid #becdb4; border-top: 4px solid var(--branch-color); border-radius: 12px; }
.pedigree-node[data-side='father'], .pedigree-side[data-side='father'] { --branch-color: #3f7269; }
.pedigree-node[data-side='mother'], .pedigree-side[data-side='mother'] { --branch-color: #8C5A35; }
.pedigree-role { margin: 0; color: #475a47; font-size: var(--t-xs); font-weight: 650; line-height: 1.3; }
.pedigree-node > .pedigree-person { flex: 1; padding: 10px; gap: 10px; min-height: 90px; border: 0; background: transparent; box-shadow: none; }
.pedigree-person .atlas-person-meta { font-size: var(--t-xs); }
.pedigree-person .atlas-relation { display: none; }
.pedigree-person .atlas-portrait { width: 36px; height: 36px; font-size: .8rem; }
.pedigree-person strong { font-size: var(--t-xs); }
.pedigree-person.is-selected { background: #e8efdf; outline: 1px solid #739b61; padding: 10px; }
.pedigree-node > .atlas-button { min-height: 48px; padding: 8px 6px; font-size: var(--t-xs); background: #f0f4e9; border-color: #d4dec9; }
.pedigree-note { margin: 0; font-size: var(--t-xs); line-height: 1.3; color: #765d3b; }
.pedigree-missing { font-size: var(--t-xs); line-height: 1.5; color: #566250; margin: auto 0; padding: 10px 0; }
.pedigree-node.is-missing { background: #f1f4eb; border-style: dashed; }
.pedigree-node.is-proposed { border-style: dashed; border-color: #a98445; }
.pedigree-surface > .pedigree-node { position: absolute; overflow: hidden; padding: 12px; gap: 6px; }
.pedigree-surface .pedigree-role { font-size: var(--t-xs); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pedigree-surface .pedigree-person { min-height: 44px; padding: 5px; }
.pedigree-surface .pedigree-person strong { font-size: var(--t-xs); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pedigree-surface .pedigree-person .atlas-person-meta { display: none; }
.pedigree-surface .pedigree-person .atlas-portrait { width: 32px; height: 32px; font-size: var(--t-xs); }
.pedigree-surface .pedigree-note { font-size: var(--t-xs); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.pedigree-surface .atlas-button { font-size: var(--t-xs); flex-shrink: 0; }
.pedigree-surface .pedigree-missing { font-size: var(--t-xs); }
.pedigree-diagram > .atlas-hint { padding: 0 18px; }
.pedigree-list { display: none; }
.pedigree-list > .pedigree-node { max-width: 440px; margin: 0 auto 24px; background: #e8efdf; }
.pedigree-sides { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.pedigree-side { min-width: 0; border-top: 3px solid var(--branch-color, #798a71); padding-top: 18px; }
.pedigree-side > h3 { color: var(--branch-color, #53645d); font-size: 1rem; margin-bottom: 16px; }
.pedigree-ancestors { margin: 0 0 16px 12px; border-left: 2px solid #c4d1b9; padding-left: 12px; }
.pedigree-ancestors > summary { cursor: pointer; padding: 16px 0; min-height: 56px; font-size: .8rem; color: #45613c; line-height: 1.5; overflow-wrap: anywhere; }
.pedigree-parent-list { display: grid; gap: 18px; }
.pedigree[data-mode='list'] .pedigree-list { display: block; }
.pedigree[data-mode='list'] .pedigree-diagram { display: none; }
@media (max-width: 1199px) {
  .pedigree[data-mode='auto'] .pedigree-list { display: block; }
  .pedigree[data-mode='auto'] .pedigree-diagram { display: none; }
}
@media (max-width: 699px) {
  .atlas-genealogy { padding: 18px 12px; }
  .pedigree-choices { grid-template-columns: minmax(0, 1fr); }
  .pedigree[data-mode='auto'] .pedigree-list { display: block; }
  .pedigree[data-mode='auto'] .pedigree-diagram { display: none; }
  .pedigree-sides { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .pedigree-node { padding: 10px; }
  .pedigree-node > .pedigree-person { padding: 8px 0; }
  .pedigree-node .atlas-person-copy { flex: 1; }
  .pedigree-person .atlas-portrait { display: none; }
  .pedigree-person strong { font-size: 1rem; }
  .pedigree-ancestors { margin-left: 6px; padding-left: 8px; }
  .pedigree-viewport { height: 560px; }
}

/* ---------- «L'albero»: la vista illustrata ---------- */
/* Corteccia grigio-oliva (il marrone era stato scartato), foglie nei verdi del quaderno,
   medaglioni con l'anello d'oro e il cartiglio di pergamena chiara. Nessun filtro: su un
   iPad vecchio decine di filtri su un disegno grande costano la scheda. */
.albero-illustrato { display: grid; gap: 10px; }
.albero-comandi { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.albero-comandi .albero-comando { min-height: 48px; min-width: 48px; font-size: 1.1rem; }
.albero-livello { min-width: 3.5em; text-align: center; font-variant-numeric: tabular-nums; color: var(--inchiostro-tenue); }
.albero-cornice {
  position: relative; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none;
  height: min(78dvh, 900px); min-height: 420px; border: 1px solid var(--linea); border-radius: var(--r-m);
  background: linear-gradient(180deg, #EEF3EC 0%, #F6F7F0 55%, #EDF1E6 100%);
  cursor: grab;
}
.albero-cornice:active { cursor: grabbing; }
.albero-cornice:focus-visible { outline: 3px solid var(--primario); outline-offset: 2px; }
.albero-scena { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.albero-arte { position: absolute; inset: 0; display: block; overflow: visible; }
.albero-ombra { fill: rgba(32, 59, 52, .12); }
.albero-erba path { fill: none; stroke: #6E8F74; stroke-width: 1.6; stroke-linecap: round; }
.albero-tronco { fill: #5B6A55; stroke: #46533F; stroke-width: 2; }
.albero-radici path { fill: none; stroke: #52604D; stroke-width: 9; stroke-linecap: round; }
.albero-rami path { fill: none; stroke: #5B6A55; stroke-linecap: round; }
.albero-chioma circle { fill: #D5E2CE; opacity: .55; }
.albero-corteccia path { fill: none; stroke: rgba(255, 255, 255, .16); stroke-width: 2; stroke-linecap: round; }
.albero-rami path.is-incerto { stroke: #B9C3B2; stroke-width: 3; stroke-dasharray: 1 9; }
.albero-luce path { fill: none; stroke: rgba(255, 255, 255, .18); stroke-linecap: round; transform: translate(-2px, 0); }
.albero-foglie use { stroke: rgba(32, 59, 52, .25); stroke-width: .6; }
.albero-foglie .tono-0 { fill: #6E8F74; }
.albero-foglie .tono-1 { fill: #4F7A5B; }
.albero-foglie .tono-2 { fill: #97B489; }
.albero-nastro .fascia { fill: #F2EDDA; stroke: #C9A55A; stroke-width: 1.5; }
.albero-nastro .coda { fill: #E4DCC0; stroke: #C9A55A; stroke-width: 1.2; }
.albero-titolo { font-family: var(--titoli); font-size: 26px; fill: #173F35; }

.albero-persona {
  position: absolute; display: flex; flex-direction: column; align-items: center; gap: 0;
  padding: 0; border: 0; background: none; color: var(--inchiostro); font: inherit; text-align: center; cursor: pointer;
}
.albero-persona:focus-visible { outline: 3px solid var(--primario); outline-offset: 4px; border-radius: 10px; }
.albero-persona:focus-visible .albero-ritratto { box-shadow: 0 0 0 4px #C9A55A, 0 0 0 8px var(--primario); }
.albero-ritratto {
  display: grid; place-items: center; width: 96px; height: 96px; border-radius: 50%; overflow: hidden;
  background: var(--portrait, #396d4b); color: #fff; font-size: 1.7rem; font-weight: 600;
  box-shadow: 0 0 0 4px #F7F2E2, 0 0 0 6px #C9A55A, 0 6px 14px rgba(32, 59, 52, .28);
}
.albero-ritratto img { width: 100%; height: 100%; object-fit: cover; }
.albero-ritratto.is-iniziali { background: radial-gradient(circle at 35% 30%, #EEF3EA, #CFDDC9); color: #173F35; font-family: var(--titoli); font-weight: 400; font-size: 2rem; letter-spacing: .02em; }
.albero-cartiglio {
  position: relative; display: grid; margin-top: -10px; padding: 6px 12px 7px; min-width: 118px; max-width: 150px;
  background: #F2EDDA; border: 1px solid #C9A55A; border-radius: 3px; box-shadow: 0 2px 6px rgba(32, 59, 52, .18);
}
.albero-cartiglio::before, .albero-cartiglio::after {
  content: ''; position: absolute; top: 5px; width: 10px; height: calc(100% - 10px); background: #E4DCC0; border: 1px solid #C9A55A; z-index: -1;
}
.albero-cartiglio::before { left: -8px; clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 45% 50%); }
.albero-cartiglio::after { right: -8px; clip-path: polygon(0 0, 100% 0, 55% 50%, 100% 100%, 0 100%); }
.albero-nome { font-family: var(--titoli); font-size: 1.02rem; line-height: 1.15; color: #173F35; overflow-wrap: anywhere; }
.albero-anni { font-size: var(--t-xs); line-height: 1.3; color: var(--inchiostro-tenue); font-variant-numeric: oldstyle-nums tabular-nums; }
.albero-persona.is-radice .albero-ritratto { width: 112px; height: 112px; box-shadow: 0 0 0 5px #F7F2E2, 0 0 0 8px #C9A55A, 0 8px 18px rgba(32, 59, 52, .32); }
.albero-persona.is-selected .albero-cartiglio { background: #E3EDE4; border-color: var(--primario); }
.albero-persona.is-proposto .albero-ritratto { box-shadow: 0 0 0 4px #F7F2E2, 0 0 0 6px #C9A55A, 0 0 0 9px rgba(169, 132, 69, .35); }
.albero-persona.is-vuoto .albero-ritratto { width: 62px; height: 62px; margin-top: 17px; background: rgba(247, 248, 240, .8); color: #8A9884; border: 2px dashed #B9C3B2; box-shadow: none; font-family: var(--titoli); font-size: 1.7rem; }
.albero-persona.is-vuoto .albero-cartiglio { min-width: 0; max-width: 130px; padding: 3px 8px 4px; background: rgba(242, 237, 218, .6); border-style: dashed; }
.albero-persona.is-vuoto .albero-cartiglio::before, .albero-persona.is-vuoto .albero-cartiglio::after { display: none; }
.albero-persona.is-vuoto .albero-nome { font-size: var(--t-xs); }
.albero-persona.is-vuoto .albero-anni { font-size: var(--t-xs); line-height: 1.2; }
.albero-persona.is-vuoto .albero-nome { color: var(--inchiostro-tenue); }
@media (max-width: 699px) {
  .albero-cornice { height: min(70dvh, 620px); min-height: 380px; }
}
.pedigree-choices.albero-scelte { grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }
.albero-stampa { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
