:root {
  --papel: #f5efe3;
  --papel-2: #ece4d3;
  --tarjeta: #fffcf6;
  --tinta: #2a251f;
  --tenue: #6d6356;
  --linea: #d8ccb6;
  --linea-arbol: #a89a82;
  --acento: #2d6a4f;
  --acento-claro: #e1efe6;
  --acento-2: #b4532a;
  --hombre: #4677a6;
  --mujer: #b04f78;
  --desconocido: #8c8476;
  --peligro: #b3261e;
  --sombra: 0 1px 2px rgba(60, 45, 20, .08), 0 6px 20px rgba(60, 45, 20, .08);
  --radio: 14px;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --papel: #1b1916; --papel-2: #24211d; --tarjeta: #2a2622; --tinta: #efe7da; --tenue: #b3a895;
    --linea: #423b33; --linea-arbol: #7d7262; --acento: #6fbf95; --acento-claro: #24372d; --acento-2: #e08a5f;
    --hombre: #7fa9d4; --mujer: #e08bb0; --desconocido: #a59c8d; --peligro: #ff8a80;
    --sombra: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--papel); color: var(--tinta); font: 16px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 .5em; }
a { color: var(--acento); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ───── botones y formularios ───── */
.btn { display: inline-flex; align-items: center; gap: .4em; border: 1px solid transparent; background: var(--acento); color: #fff;
  padding: .55em 1em; border-radius: 10px; cursor: pointer; font-weight: 600; text-decoration: none; white-space: nowrap; line-height: 1.2; }
@media (prefers-color-scheme: dark) { .btn { color: #10241a; } }
.btn:hover { filter: brightness(1.07); }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn.sec { background: var(--tarjeta); color: var(--tinta); border-color: var(--linea); }
.btn.sec:hover { background: var(--papel-2); }
.btn.peligro { background: var(--peligro); color: #fff; }
.btn.fantasma { background: transparent; color: var(--acento); border-color: transparent; padding: .4em .6em; }
.btn.fantasma:hover { background: var(--acento-claro); }
.btn.peq { padding: .35em .7em; font-size: .9em; border-radius: 8px; }
.btn.mini { padding: .2em .5em; font-size: .82em; border-radius: 7px; }
.btn.enlace-peligro { background: none; border: 0; color: var(--peligro); padding: .3em .4em; font-weight: 600; cursor: pointer; }

label.campo { display: flex; flex-direction: column; gap: .25em; font-size: .9em; color: var(--tenue); font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], select, textarea {
  width: 100%; background: var(--tarjeta); border: 1px solid var(--linea); border-radius: 9px; padding: .5em .65em; color: var(--tinta);
  font-weight: 400; font-size: 1rem; min-width: 0; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, .tarjeta:focus-visible { outline: 2px solid var(--acento); outline-offset: 1px; }
textarea { resize: vertical; min-height: 6em; }
input:disabled, select:disabled, textarea:disabled { opacity: .75; }
.fila { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75em; }
.acciones { display: flex; gap: .5em; justify-content: flex-end; flex-wrap: wrap; margin-top: 1em; }
.nota { color: var(--tenue); font-size: .9em; }
.etiqueta { display: inline-block; font-size: .75em; font-weight: 700; padding: .12em .55em; border-radius: 99px; background: var(--papel-2); color: var(--tenue); vertical-align: middle; }
.etiqueta.verde { background: var(--acento-claro); color: var(--acento); }
.radios { display: flex; flex-wrap: wrap; gap: .4em; }
.radios label { display: inline-flex; align-items: center; gap: .35em; border: 1px solid var(--linea); border-radius: 99px; padding: .3em .8em; cursor: pointer; background: var(--tarjeta); color: var(--tinta); font-weight: 500; font-size: .95em; }
.radios label:has(input:checked) { border-color: var(--acento); background: var(--acento-claro); color: var(--acento); font-weight: 700; }
.radios input { accent-color: var(--acento); margin: 0; }
.check { display: inline-flex; gap: .45em; align-items: center; cursor: pointer; font-weight: 600; }
.check input { accent-color: var(--acento); width: 1.1em; height: 1.1em; }

/* fecha */
.fecha { display: grid; grid-template-columns: minmax(96px, 1.2fr) minmax(56px, .7fr) minmax(100px, 1.3fr) minmax(76px, 1fr); gap: .35em; }

/* ───── estructura ───── */
.cabecera { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1em; padding: .6em 1.2em; background: color-mix(in srgb, var(--papel) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--linea); }
.marca { display: flex; align-items: center; gap: .55em; font-family: var(--serif); font-weight: 700; font-size: 1.15rem; color: var(--tinta); text-decoration: none; white-space: nowrap; }
.marca svg { width: 30px; height: 30px; }
.nav { display: flex; gap: .2em; margin-left: .5em; }
.nav a { padding: .45em .85em; border-radius: 10px; text-decoration: none; color: var(--tenue); font-weight: 600; display: flex; align-items: center; gap: .4em; }
.nav a:hover { background: var(--papel-2); color: var(--tinta); }
.nav a.activo { background: var(--tarjeta); color: var(--acento); box-shadow: var(--sombra); }
.nav svg { width: 18px; height: 18px; }
.cab-der { margin-left: auto; display: flex; align-items: center; gap: .6em; }
.sel-arbol { max-width: 220px; }
.sinc { width: 10px; height: 10px; border-radius: 50%; background: var(--acento); box-shadow: 0 0 0 3px var(--acento-claro); flex: none; }
.sinc.error { background: var(--peligro); box-shadow: 0 0 0 3px color-mix(in srgb, var(--peligro) 25%, transparent); }
.usuario-btn { display: flex; align-items: center; gap: .45em; border: 1px solid var(--linea); background: var(--tarjeta); border-radius: 99px; padding: .25em .7em .25em .3em; cursor: pointer; }
.avatar-txt { width: 28px; height: 28px; border-radius: 50%; background: var(--acento); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .85em; }
.menu { position: absolute; right: 1em; top: 3.4em; background: var(--tarjeta); border: 1px solid var(--linea); border-radius: 12px; box-shadow: var(--sombra); padding: .4em; min-width: 220px; z-index: 50; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: .55em .8em; border-radius: 8px; cursor: pointer; }
.menu button:hover { background: var(--papel-2); }
.menu .sep { height: 1px; background: var(--linea); margin: .3em 0; }

main#vista { min-height: calc(100vh - 58px); }
.pagina { max-width: 1100px; margin: 0 auto; padding: 1.5em 1.2em 5em; }
.panel { background: var(--tarjeta); border: 1px solid var(--linea); border-radius: var(--radio); padding: 1.2em 1.3em; box-shadow: var(--sombra); margin-bottom: 1.2em; }
.panel h2 { font-size: 1.25rem; }
.vacio { text-align: center; color: var(--tenue); padding: 2em 1em; }

/* ───── árbol ───── */
.vista-arbol { position: relative; height: calc(100vh - 58px); overflow: hidden; }
.barra-arbol { position: absolute; z-index: 5; top: .8em; left: .8em; right: .8em; display: flex; gap: .5em; flex-wrap: wrap; align-items: center; pointer-events: none; }
.barra-arbol > * { pointer-events: auto; }
.barra-arbol .grupo { display: flex; gap: .4em; align-items: center; background: var(--tarjeta); border: 1px solid var(--linea); border-radius: 12px; padding: .3em .5em; box-shadow: var(--sombra); font-size: .9em; }
.barra-arbol .grupo select { width: auto; padding: .25em .4em; }
.barra-arbol input[type=search] { width: 230px; box-shadow: var(--sombra); }
.zoom { margin-left: auto; }
.zoom button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--linea); background: var(--tarjeta); cursor: pointer; font-size: 1.1em; display: grid; place-items: center; }
#svgArbol { width: 100%; height: 100%; touch-action: none; cursor: grab; display: block;
  background-image: radial-gradient(color-mix(in srgb, var(--linea) 70%, transparent) 1px, transparent 1px); background-size: 22px 22px; }
#svgArbol:active { cursor: grabbing; }
.lineas path { stroke: var(--linea-arbol); stroke-width: 2; fill: none; stroke-linecap: round; }
.lineas path.l-union { stroke: var(--acento-2); stroke-width: 2.5; }
.lineas path.l-medio { stroke-dasharray: 5 5; }
.tarjeta { cursor: pointer; }
.tarjeta .t-fondo { fill: var(--tarjeta); stroke: var(--linea); stroke-width: 1.2; filter: drop-shadow(0 2px 4px rgba(60, 45, 20, .1)); }
.tarjeta:hover .t-fondo { stroke: var(--acento); }
.tarjeta.fallecida .t-fondo { fill: color-mix(in srgb, var(--tarjeta) 82%, var(--papel-2)); }
.tarjeta.foco .t-fondo { stroke: var(--acento); stroke-width: 2.5; }
.tarjeta.seleccionada .t-fondo { stroke: var(--acento-2); stroke-width: 3; }
.t-banda { fill: var(--desconocido); }
.s-hombre .t-banda, .s-hombre .t-ini-fondo { fill: var(--hombre); }
.s-mujer .t-banda, .s-mujer .t-ini-fondo { fill: var(--mujer); }
.t-ini-fondo { fill: var(--desconocido); opacity: .9; }
.t-aro { fill: none; stroke: var(--linea); stroke-width: 1.5; }
.t-ini { fill: #fff; font: 700 16px var(--sans); text-anchor: middle; }
.t-nom { fill: var(--tinta); font: 700 14.5px var(--sans); }
.t-ape { fill: var(--tinta); font: 500 13.5px var(--sans); }
.t-fec { fill: var(--tenue); font: 500 12.5px var(--sans); }
.t-cruz { fill: var(--tenue); font: 600 14px var(--serif); text-anchor: middle; }
.t-medio { fill: var(--tenue); font: 700 12px var(--sans); text-anchor: middle; }
.acciones-sel { position: absolute; z-index: 6; left: 50%; bottom: 1.2em; transform: translateX(-50%); background: var(--tarjeta); border: 1px solid var(--linea);
  border-radius: 16px; box-shadow: var(--sombra); padding: .6em .7em; display: flex; flex-direction: column; gap: .5em; max-width: calc(100% - 1.6em); }
.acciones-sel .quien { font-weight: 700; font-family: var(--serif); padding: 0 .3em; display: flex; justify-content: space-between; gap: 1em; }
.acciones-sel .botones { display: flex; gap: .35em; flex-wrap: wrap; }
.arbol-vacio { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 2em; }

/* ───── ficha (panel lateral) ───── */
.ficha { position: fixed; z-index: 40; top: 0; right: 0; bottom: 0; width: min(600px, 100%); background: var(--papel); border-left: 1px solid var(--linea);
  box-shadow: -10px 0 40px rgba(40, 30, 10, .18); display: flex; flex-direction: column; transform: translateX(105%); transition: transform .25s ease; }
.ficha.abierta { transform: none; }
.ficha-cab { display: flex; gap: 1em; padding: 1.1em 1.2em .8em; align-items: center; border-bottom: 1px solid var(--linea); background: var(--tarjeta); }
.ficha-foto { width: 76px; height: 76px; border-radius: 50%; object-fit: cover; flex: none; border: 3px solid var(--linea); background: var(--papel-2); display: grid; place-items: center; font: 700 1.5em var(--sans); color: #fff; cursor: pointer; }
.ficha-foto.s-hombre { background: var(--hombre); } .ficha-foto.s-mujer { background: var(--mujer); } .ficha-foto.s-desconocido { background: var(--desconocido); }
.ficha-titulo { flex: 1; min-width: 0; }
.ficha-titulo h2 { font-size: 1.35rem; margin: 0; overflow-wrap: anywhere; }
.ficha-titulo .sub { color: var(--tenue); font-size: .92em; }
.ficha-cerrar { align-self: flex-start; border: 0; background: none; font-size: 1.7em; line-height: 1; cursor: pointer; color: var(--tenue); padding: 0 .2em; }
.ficha-botones { display: flex; gap: .4em; flex-wrap: wrap; padding: .7em 1.2em; border-bottom: 1px solid var(--linea); background: var(--tarjeta); }
.pestanas { display: flex; gap: .2em; padding: 0 1em; background: var(--tarjeta); border-bottom: 1px solid var(--linea); overflow-x: auto; }
.pestanas button { border: 0; background: none; padding: .7em .9em; cursor: pointer; font-weight: 600; color: var(--tenue); border-bottom: 3px solid transparent; white-space: nowrap; }
.pestanas button.activa { color: var(--acento); border-bottom-color: var(--acento); }
.ficha-cuerpo { flex: 1; overflow-y: auto; padding: 1.1em 1.2em 6em; }
.ficha-pie { position: absolute; left: 0; right: 0; bottom: 0; padding: .7em 1.2em; background: var(--tarjeta); border-top: 1px solid var(--linea); display: flex; gap: .5em; align-items: center; }
.ficha-pie .estado { color: var(--tenue); font-size: .9em; margin-right: auto; }
.seccion { margin-bottom: 1.4em; }
.seccion > h3 { font-size: 1.02rem; color: var(--acento); margin-bottom: .6em; display: flex; align-items: center; gap: .5em; }
.seccion .fila + .fila, .seccion .fila + label, .seccion label + .fila, .seccion label + label { margin-top: .7em; }
.banner { background: color-mix(in srgb, var(--acento-2) 14%, var(--tarjeta)); border: 1px solid color-mix(in srgb, var(--acento-2) 40%, transparent); border-radius: 10px; padding: .6em .8em; margin-bottom: 1em; font-size: .95em; }

/* listas de familiares */
.familiar { display: flex; align-items: center; gap: .7em; padding: .5em .6em; border: 1px solid var(--linea); border-radius: 12px; background: var(--tarjeta); margin-bottom: .45em; }
.familiar .mini { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: .85em; background: var(--desconocido); }
.mini.s-hombre { background: var(--hombre); } .mini.s-mujer { background: var(--mujer); }
.familiar .info { flex: 1; min-width: 0; cursor: pointer; }
.familiar .info b { display: block; overflow-wrap: anywhere; }
.familiar .info span { color: var(--tenue); font-size: .88em; }
.union-datos { border: 1px dashed var(--linea); border-radius: 12px; padding: .7em; margin: -.2em 0 .7em; background: var(--papel-2); }

/* fotos */
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: .6em; }
.galeria figure { margin: 0; position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--papel-2); cursor: pointer; border: 1px solid var(--linea); }
.galeria img { width: 100%; height: 100%; object-fit: cover; display: block; }
.galeria .estrella { position: absolute; top: 6px; left: 6px; background: var(--acento-2); color: #fff; border-radius: 99px; font-size: .72em; font-weight: 700; padding: .1em .5em; }
.galeria figcaption { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); color: #fff; font-size: .78em; padding: 1.2em .5em .35em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subir { border: 2px dashed var(--linea); border-radius: 12px; padding: 1.1em; text-align: center; margin-bottom: 1em; color: var(--tenue); }
.subir.encima { border-color: var(--acento); background: var(--acento-claro); }
.visor img { max-width: 100%; max-height: 62vh; display: block; margin: 0 auto 1em; border-radius: 10px; }

/* fuentes */
.fuente { border-left: 3px solid var(--acento); padding: .4em .8em; margin-bottom: .7em; background: var(--tarjeta); border-radius: 0 10px 10px 0; }
.fuente .cab { display: flex; gap: .5em; align-items: center; flex-wrap: wrap; }
.fuente .val { margin: .2em 0; overflow-wrap: anywhere; }

/* ───── lista ───── */
.barra-lista { display: flex; gap: .6em; flex-wrap: wrap; margin-bottom: 1em; align-items: center; }
.barra-lista input[type=search] { flex: 1 1 240px; }
.barra-lista select { width: auto; }
.tabla { width: 100%; border-collapse: collapse; background: var(--tarjeta); border-radius: var(--radio); overflow: hidden; box-shadow: var(--sombra); }
.tabla th, .tabla td { text-align: left; padding: .6em .8em; border-bottom: 1px solid var(--linea); vertical-align: middle; }
.tabla th { font-size: .82em; text-transform: uppercase; letter-spacing: .04em; color: var(--tenue); background: var(--papel-2); }
.tabla tbody tr { cursor: pointer; }
.tabla tbody tr:hover { background: var(--acento-claro); }
.tabla .nom { display: flex; gap: .6em; align-items: center; font-weight: 600; }
@media (max-width: 760px) { .tabla .ocultar-movil { display: none; } }

/* ───── buscar ───── */
.buscar-grid { display: grid; grid-template-columns: 360px 1fr; gap: 1.2em; align-items: start; }
@media (max-width: 900px) { .buscar-grid { grid-template-columns: 1fr; } }
.filtros { position: sticky; top: 72px; }
.filtros .fila { grid-template-columns: 1fr 1fr; }
.fila-familiar { display: grid; grid-template-columns: 112px 1fr auto; gap: .35em; margin-bottom: .4em; }
.fuentes-estado { display: flex; gap: .5em; flex-wrap: wrap; margin-bottom: 1em; }
.fuentes-estado span { font-size: .88em; padding: .3em .7em; border-radius: 99px; background: var(--tarjeta); border: 1px solid var(--linea); }
.fuentes-estado .ok { border-color: var(--acento); color: var(--acento); }
.fuentes-estado .mal { border-color: var(--peligro); color: var(--peligro); }
.resultado { background: var(--tarjeta); border: 1px solid var(--linea); border-radius: var(--radio); padding: 1em 1.1em; margin-bottom: .9em; box-shadow: var(--sombra); }
.resultado .cab { display: flex; gap: .8em; align-items: flex-start; }
.resultado .cab img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex: none; }
.resultado h3 { font-size: 1.1rem; margin: 0 0 .15em; }
.parecido { margin-left: auto; text-align: right; flex: none; font-size: .85em; color: var(--tenue); }
.parecido .barra { width: 90px; height: 7px; background: var(--papel-2); border-radius: 9px; overflow: hidden; margin-top: .25em; }
.parecido .barra i { display: block; height: 100%; background: var(--acento); }
.datos-res { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .2em 1em; margin: .7em 0; font-size: .95em; }
.datos-res dt { color: var(--tenue); font-size: .82em; font-weight: 700; }
.datos-res dd { margin: 0 0 .3em; overflow-wrap: anywhere; }
.chips { display: flex; gap: .35em; flex-wrap: wrap; margin: .3em 0; }
.chip { font-size: .85em; border: 1px solid var(--linea); border-radius: 99px; padding: .15em .6em; background: var(--papel-2); }
.comparar { width: 100%; border-collapse: collapse; margin-top: .8em; font-size: .93em; }
.comparar th, .comparar td { padding: .45em .5em; border-top: 1px solid var(--linea); text-align: left; vertical-align: top; }
.comparar th { color: var(--tenue); font-size: .8em; text-transform: uppercase; }
.comparar td.igual { color: var(--acento); font-weight: 700; }
.fam-res { display: flex; gap: .6em; align-items: center; padding: .4em 0; border-top: 1px solid var(--linea); flex-wrap: wrap; }
.fam-res .q { flex: 1; min-width: 180px; }
.fotos-res { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7em; }
.foto-res { background: var(--tarjeta); border: 1px solid var(--linea); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
.foto-res img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--papel-2); }
.foto-res .t { padding: .4em .5em; font-size: .78em; color: var(--tenue); flex: 1; overflow-wrap: anywhere; }
.foto-res .btn { margin: 0 .5em .5em; justify-content: center; }
.enlaces { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .6em; }
.enlace { display: block; text-decoration: none; color: var(--tinta); background: var(--tarjeta); border: 1px solid var(--linea); border-radius: 12px; padding: .7em .85em; }
.enlace:hover { border-color: var(--acento); }
.enlace b { color: var(--acento); }
.enlace span { display: block; font-size: .85em; color: var(--tenue); }
.cargando::after { content: ''; display: inline-block; width: .9em; height: .9em; border: 2px solid var(--linea); border-top-color: var(--acento); border-radius: 50%; animation: gira .8s linear infinite; vertical-align: -2px; margin-left: .4em; }
@keyframes gira { to { transform: rotate(360deg); } }

/* ───── compartir ───── */
.miembro { display: flex; align-items: center; gap: .8em; padding: .6em 0; border-bottom: 1px solid var(--linea); flex-wrap: wrap; }
.miembro .q { flex: 1; min-width: 160px; }
.miembro .q span { display: block; color: var(--tenue); font-size: .88em; }
.miembro select { width: auto; }
.enlace-inv { display: flex; gap: .4em; margin-top: .6em; }
.cambio { display: flex; gap: .8em; padding: .5em 0; border-bottom: 1px solid var(--linea); font-size: .95em; }
.cambio time { color: var(--tenue); font-size: .85em; white-space: nowrap; min-width: 115px; }

/* ───── entrada ───── */
.entrada { min-height: 100vh; display: grid; place-items: center; padding: 1.5em; background:
  radial-gradient(1200px 500px at 10% -10%, var(--acento-claro), transparent), radial-gradient(900px 500px at 110% 110%, color-mix(in srgb, var(--acento-2) 14%, transparent), transparent), var(--papel); }
.entrada-caja { width: min(440px, 100%); background: var(--tarjeta); border: 1px solid var(--linea); border-radius: 20px; box-shadow: var(--sombra); padding: 1.8em 1.6em; }
.entrada-caja .logo { text-align: center; margin-bottom: 1em; }
.entrada-caja .logo svg { width: 64px; height: 64px; }
.entrada-caja h1 { text-align: center; font-size: 1.7rem; margin-bottom: .2em; }
.entrada-caja .lema { text-align: center; color: var(--tenue); margin: 0 0 1.2em; }
.entrada-caja form { display: flex; flex-direction: column; gap: .8em; }
.entrada-caja .pestanas { background: none; justify-content: center; margin-bottom: 1em; padding: 0; }
.error-txt { color: var(--peligro); font-weight: 600; font-size: .92em; min-height: 1.2em; }

/* ───── modal y aviso ───── */
.modal-fondo { position: fixed; inset: 0; z-index: 100; background: rgba(30, 22, 10, .45); display: grid; place-items: center; padding: 1em; animation: aparece .15s; }
.modal { position: relative; width: 100%; background: var(--papel); border-radius: 18px; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); padding: 1.4em 1.4em 1.2em; max-height: calc(100vh - 2em); overflow-y: auto; }
.modal h2 { font-size: 1.3rem; padding-right: 1.5em; }
.modal-x { position: absolute; top: .5em; right: .6em; border: 0; background: none; font-size: 1.8em; line-height: 1; cursor: pointer; color: var(--tenue); }
.modal .pestanas { background: none; padding: 0; margin: 0 0 1em; }
.modal form { display: flex; flex-direction: column; gap: .8em; }
.confirmar-txt { font-size: 1.05em; margin: .3em 0 0; }
@keyframes aparece { from { opacity: 0; } }
.aviso { position: fixed; z-index: 200; left: 50%; bottom: 1.5em; transform: translate(-50%, 150%); background: var(--tinta); color: var(--papel); padding: .7em 1.1em; border-radius: 12px;
  box-shadow: var(--sombra); max-width: min(560px, calc(100% - 2em)); transition: transform .25s; font-weight: 600; pointer-events: none; }
.aviso.visible { transform: translate(-50%, 0); }
.aviso.error { background: var(--peligro); color: #fff; }
.aviso.ok { background: var(--acento); color: #fff; }

/* ───── móvil ───── */
.nav-movil { display: none; }
@media (max-width: 760px) {
  .cabecera { padding: .5em .8em; gap: .5em; }
  .cabecera .nav { display: none; }
  .marca span { display: none; }
  .sel-arbol { max-width: 150px; }
  .nav-movil { display: flex; position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; background: var(--tarjeta); border-top: 1px solid var(--linea); padding: .3em .3em calc(.3em + env(safe-area-inset-bottom)); }
  .nav-movil a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .1em; font-size: .72em; font-weight: 700; color: var(--tenue); text-decoration: none; padding: .3em 0; border-radius: 10px; }
  .nav-movil a.activo { color: var(--acento); background: var(--acento-claro); }
  .nav-movil svg { width: 22px; height: 22px; }
  .vista-arbol { height: calc(100vh - 52px - 62px); height: calc(100dvh - 52px - 62px); }
  .barra-arbol input[type=search] { width: 100%; flex: 1 1 100%; order: 3; }
  .acciones-sel { bottom: .6em; }
  .pagina { padding-bottom: 7em; }
  .ficha { z-index: 45; }
  .fecha { grid-template-columns: 1fr 1fr; }
}
