/* HUMANIDAD — Lámina de Legado v1 (hoja de impresión del árbol). */
@font-face { font-family: HPrintSerif; src: url('/assets/fonts/PlayfairDisplay-SemiBold.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: HPrintSans; src: url('/assets/fonts/Inter-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: HPrintSansBold; src: url('/assets/fonts/Inter-SemiBold.ttf') format('truetype'); font-display: swap; }

html.htp-open, html.htp-open body { overflow: hidden !important; }

.htp-root {
  --htp-ink: #0B1422;
  --htp-panel: #111D30;
  --htp-panel-2: #172540;
  --htp-line: rgba(214, 178, 106, .22);
  --htp-gold: #D6B26A;
  --htp-gold-ink: #1B1405;
  --htp-text: #EEF1F6;
  --htp-soft: #A7B0C0;
  position: fixed; inset: 0; z-index: 2147483000;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  color: var(--htp-text);
}
.htp-root *, .htp-root *::before, .htp-root *::after { box-sizing: border-box; }
.htp-backdrop { position: absolute; inset: 0; background: rgba(3, 7, 14, .66); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }

.htp-sheet {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(1120px, calc(100vw - 48px)); max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: var(--htp-panel); border: 1px solid var(--htp-line); border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5); overflow: hidden;
}
.htp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 14px; border-bottom: 1px solid var(--htp-line); }
.htp-kicker { display: block; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--htp-gold); font-weight: 600; }
.htp-head h2 { margin: 2px 0 0; font-family: 'Playfair Display', HPrintSerif, Georgia, serif; font-size: 24px; font-weight: 600; color: var(--htp-text); }
.htp-close { width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--htp-line); background: var(--htp-panel-2); color: var(--htp-text); display: grid; place-items: center; cursor: pointer; }
.htp-close svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.htp-body { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr); min-height: 0; flex: 1; }
.htp-stage { padding: 18px; background: radial-gradient(circle at 50% 30%, #1A2A47 0%, var(--htp-ink) 75%); display: flex; flex-direction: column; min-height: 0; }
.htp-preview { flex: 1; min-height: 260px; display: grid; place-items: center; transition: opacity .2s ease; }
.htp-preview.is-loading { opacity: .45; }
.htp-preview svg { max-width: 100%; max-height: calc(100vh - 220px); width: auto; height: auto; display: block; border-radius: 4px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55); background: #F7F1E3; }
.htp-meta { margin: 10px 0 0; text-align: center; font-size: 12.5px; color: var(--htp-soft); }

.htp-side { padding: 18px 20px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; border-left: 1px solid var(--htp-line); }
.htp-controls { display: flex; flex-direction: column; gap: 14px; }
/* El panel lateral se desplaza; sus piezas no se aplastan (el estado quedaba en 0 px). */
.htp-side > * { flex-shrink: 0; }
.htp-field { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 7px; }
.htp-field legend, .htp-legend { padding: 0; font-size: 12px; font-weight: 600; letter-spacing: .04em; color: var(--htp-soft); text-transform: uppercase; margin-bottom: 7px; }
.htp-seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
.htp-seg input { position: absolute; opacity: 0; pointer-events: none; }
.htp-seg label { display: flex; flex-direction: column; justify-content: center; gap: 2px; min-height: 52px; padding: 8px 10px; border-radius: 13px; border: 1px solid var(--htp-line); background: var(--htp-panel-2); cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.htp-seg label span { font-size: 14px; font-weight: 600; color: var(--htp-text); }
.htp-seg label small { font-size: 11px; color: var(--htp-soft); }
.htp-seg input:checked + label { border-color: var(--htp-gold); background: rgba(214, 178, 106, .14); box-shadow: inset 0 0 0 1px var(--htp-gold); }
.htp-seg input:focus-visible + label { outline: 2px solid var(--htp-gold); outline-offset: 2px; }
/* Selector desplegable (Desde quién) con flecha propia */
.htp-select-box { position: relative; display: block; }
.htp-select select { -webkit-appearance: none; appearance: none; width: 100%; min-height: 50px; padding: 0 44px 0 14px; border-radius: 14px; border: 1px solid var(--htp-line); background: var(--htp-panel-2); color: var(--htp-text); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.htp-select select:focus-visible { outline: 2px solid var(--htp-gold); outline-offset: 2px; }
.htp-select-chevron { position: absolute; right: 14px; top: 50%; width: 20px; height: 20px; transform: translateY(-50%); pointer-events: none; color: var(--htp-gold); }
.htp-select-chevron svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* Variantes de opciones */
.htp-seg--grid3 { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); }
.htp-seg--cards { grid-auto-flow: row; grid-template-columns: repeat(2, 1fr); }
.htp-seg--cards label { align-items: flex-start; text-align: left; min-height: 78px; padding: 12px 12px 11px; gap: 3px; }
.htp-seg--cards label span { font-size: 14.5px; }
.htp-seg--cards label small { font-size: 11.5px; line-height: 1.3; }
.htp-seg-icon { display: block; width: 26px; height: 26px; margin-bottom: 3px; color: var(--htp-soft); }
.htp-seg-icon svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.htp-seg input:checked + label .htp-seg-icon { color: var(--htp-gold); }
.htp-seg--chips { grid-auto-columns: minmax(44px, 1fr); }
.htp-seg--chips label { min-height: 46px; padding: 0; }
.htp-seg--chips label span { font-size: 16px; }

/* Aviso de legibilidad del tamaño */
.htp-size-hint { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: -4px; padding: 10px 12px; border-radius: 13px; font-size: 12.5px; line-height: 1.4; }
.htp-size-hint[hidden] { display: none; }
.htp-size-hint[data-kind="ok"] { color: #9FD8B4; background: rgba(159, 216, 180, .08); border: 1px solid rgba(159, 216, 180, .22); }
.htp-size-hint[data-kind="warn"] { color: #F3D9A0; background: rgba(214, 178, 106, .1); border: 1px solid rgba(214, 178, 106, .4); }
.htp-size-hint span { flex: 1 1 200px; }
.htp-hint-btn { min-height: 38px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--htp-gold); background: transparent; color: var(--htp-gold); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.htp-hint-btn:focus-visible { outline: 2px solid var(--htp-gold); outline-offset: 2px; }
.htp-select[hidden] { display: none; }

.htp-toggles { display: flex; flex-direction: column; gap: 8px; }
.htp-toggle { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 13px; border: 1px solid var(--htp-line); background: var(--htp-panel-2); cursor: pointer; }
.htp-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.htp-switch { width: 40px; height: 24px; border-radius: 99px; background: #2B3A55; position: relative; transition: background .15s; }
.htp-switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #E8ECF3; transition: transform .15s; }
.htp-toggle input:checked ~ .htp-switch { background: var(--htp-gold); }
.htp-toggle input:checked ~ .htp-switch::after { transform: translateX(16px); }
.htp-toggle input:focus-visible ~ .htp-switch { outline: 2px solid var(--htp-gold); outline-offset: 2px; }
.htp-toggle-text { display: flex; flex-direction: column; gap: 1px; }
.htp-toggle-text strong { font-size: 14px; font-weight: 600; }
.htp-toggle-text small { font-size: 11.5px; color: var(--htp-soft); }

.htp-status { margin: 0; min-height: 0; font-size: 13.5px; color: var(--htp-soft); }
.htp-status:empty { display: none; }
.htp-status[data-kind="error"] { color: #F2A7A0; }
.htp-status[data-kind="ok"] { color: #9FD8B4; }
.htp-status[data-kind="busy"] { color: var(--htp-gold); }

.htp-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: auto; }
.htp-actions .htp-primary { grid-column: 1 / -1; }
.htp-btn { min-height: 48px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--htp-line); background: var(--htp-panel-2); color: var(--htp-text); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.htp-btn:disabled { opacity: .5; cursor: progress; }
.htp-btn.htp-primary { background: var(--htp-gold); border-color: var(--htp-gold); color: var(--htp-gold-ink); }
.htp-btn:focus-visible, .htp-close:focus-visible { outline: 2px solid var(--htp-gold); outline-offset: 2px; }

.htp-ready, .htp-email { padding: 14px; border-radius: 16px; border: 1px solid var(--htp-gold); background: rgba(214, 178, 106, .08); display: flex; flex-direction: column; gap: 10px; }
.htp-ready p { margin: 0; font-size: 14px; font-weight: 600; }
.htp-ready-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.htp-ready-actions .htp-btn { flex: 1 1 140px; }
.htp-email input[type="email"] { min-height: 46px; padding: 0 12px; border-radius: 13px; border: 1px solid var(--htp-line); background: var(--htp-panel-2); color: var(--htp-text); font: inherit; font-size: 16px; }
.htp-email input[hidden] { display: none; }
.htp-note { margin: 0; font-size: 12.5px; color: var(--htp-soft); }

/* Botón en el dock del árbol */
.htp-trigger svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.htp-trigger-floating { position: absolute !important; left: 12px; bottom: 12px; top: auto; right: auto; z-index: 6; display: inline-flex !important; align-items: center; justify-content: center; gap: 7px; width: 48px; height: 48px; min-width: 48px; padding: 0; margin: 0; border-radius: 50%; border: 1px solid rgba(214, 178, 106, .55); background: rgba(16, 36, 62, .94); color: #E7C887; font: 600 14px/1 Inter, system-ui, sans-serif; cursor: pointer; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); -webkit-tap-highlight-color: transparent; }
.htp-trigger-floating span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.htp-trigger-floating svg { width: 22px; height: 22px; flex: none; }
.htp-trigger-floating:hover { border-color: #E7C887; }
.htp-trigger-floating:focus-visible { outline: 2px solid #E7C887; outline-offset: 2px; }
/* En pantallas anchas hay lugar para la palabra. */
@media (min-width: 900px) { .htp-trigger-floating { width: auto; padding: 0 16px; border-radius: 14px; } .htp-trigger-floating span { position: static; width: auto; height: auto; clip: auto; } }

/* Opción A: dentro de la barra de leyenda (fuera del lienzo). La leyenda se corre a la
   izquierda para dejar lugar al botón; especificidad igual a la de tree-explore-v4. */
html body #accountModal #familyView#familyView .tree-explore-v4 #familyMemberList#familyMemberList .htr-legend-footer.htp-has-print,
.htr-legend-footer.htp-has-print { justify-content: flex-start !important; padding-left: 12px !important; padding-right: 108px !important; }
.htp-trigger-legend { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); z-index: 3; display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; margin: 0; border-radius: 9px; border: 1px solid rgba(214, 178, 106, .6); background: transparent; color: #E7C887; font: 600 12px/1 Inter, system-ui, sans-serif; letter-spacing: .01em; cursor: pointer; pointer-events: auto !important; -webkit-tap-highlight-color: transparent; }
.htp-trigger-legend::before { content: ''; position: absolute; inset: -9px -4px; } /* área táctil de 44 px */
.htp-trigger-legend svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.htp-trigger-legend:hover, .htp-trigger-legend:active { background: rgba(214, 178, 106, .14); }
.htp-trigger-legend:focus-visible { outline: 2px solid #E7C887; outline-offset: 2px; }
@media (max-width: 340px) { .htp-trigger-legend span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } .htp-trigger-legend { padding: 0 8px; } .htr-legend-footer.htp-has-print { padding-right: 52px !important; } }

/* Móvil: hoja inferior, vista previa arriba y controles abajo */
@media (max-width: 760px) {
  .htp-sheet { left: 0; right: 0; top: auto; bottom: 0; transform: none; width: 100%; max-height: calc(100dvh - 12px); border-radius: 22px 22px 0 0; border-bottom: 0; }
  .htp-head { padding: 14px 16px 10px; }
  .htp-head h2 { font-size: 21px; }
  .htp-body { display: flex; flex-direction: column; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .htp-stage { padding: 14px; flex: none; }
  .htp-preview { min-height: 200px; }
  .htp-preview svg { max-height: 42dvh; }
  .htp-side { border-left: 0; border-top: 1px solid var(--htp-line); overflow: visible; padding: 16px 16px calc(18px + env(safe-area-inset-bottom)); }
  .htp-seg label { min-height: 50px; padding: 6px 4px; }
  .htp-seg label span { font-size: 13.5px; }
  /* Barra fija sólida: el contenido pasa por debajo sin quedar a medio tapar. */
  .htp-actions { position: sticky; bottom: 0; z-index: 2; margin: 4px -16px calc(-18px - env(safe-area-inset-bottom)); padding: 12px 16px calc(14px + env(safe-area-inset-bottom)); background: var(--htp-panel); border-top: 1px solid var(--htp-line); box-shadow: 0 -10px 24px rgba(5, 10, 20, .55); }
  .htp-seg--cards label { min-height: 74px; }
}
@media (prefers-reduced-motion: reduce) { .htp-root * { transition: none !important; } }

/* Computadora: «Imprimir» en la cabecera del árbol, a la izquierda de «+ Invitar».
   Se agrega una columna a la grilla de tree-explore-v4; sólo con htp-has-print. */
@media (min-width: 681px) {
  html body #accountModal #familyView#familyView .account-view.tree-header-v2.htc-tree-view.tree-explore-v4[data-view="tree"].active #familyTreeHeader .tree-head-actions.htp-has-print { grid-template-columns: minmax(0, 1fr) auto auto !important; }
  html body #accountModal #familyView#familyView .account-view.tree-header-v2.htc-tree-view.tree-explore-v4[data-view="tree"].active #familyTreeHeader .tree-head-actions.htp-has-print > .htp-trigger-header { grid-area: 1 / 2 / 3 / 3 !important; }
  html body #accountModal #familyView#familyView .account-view.tree-header-v2.htc-tree-view.tree-explore-v4[data-view="tree"].active #familyTreeHeader .tree-head-actions.htp-has-print > .tree-invite-action { grid-area: 1 / 3 / 3 / 4 !important; }
}
.htp-trigger-header {
  align-self: center; justify-self: end; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 44px; min-width: 44px; padding: 0 14px; box-sizing: border-box; border-radius: 11px;
  border: 1px solid rgba(214, 178, 106, .6); background: transparent; color: #E7C887;
  font: 600 14px/1 Inter, system-ui, sans-serif; cursor: pointer; white-space: nowrap; margin: 0;
}
.htp-trigger-header:hover { background: rgba(214, 178, 106, .1); }
.htp-trigger-header:focus-visible { outline: 2px solid #F0D18C; outline-offset: 2px; }
.htp-trigger-header svg { width: 17px; height: 17px; flex: none; }
