:root {
  --fondo: #f6f8fa;
  --panel: #ffffff;
  --texto: #1f2328;
  --suave: #59636e;
  --borde: #d1d9e0;
  --acento: #1f6feb;
  --acento-texto: #ffffff;
  --resalte: #ffb000;
  --peligro: #cf222e;
  --ok: #1a7f37;
  --sombra: 0 1px 3px rgba(31, 35, 40, .12), 0 8px 24px rgba(66, 74, 83, .12);
  --radio: 8px;
  --panel-ancho: 360px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fondo: #0d1117; --panel: #161b22; --texto: #e6edf3; --suave: #9198a1; --borde: #30363d;
    --acento: #4493f8; --sombra: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fondo: #0d1117; --panel: #161b22; --texto: #e6edf3; --suave: #9198a1; --borde: #30363d;
  --acento: #4493f8; --sombra: 0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--texto); background: var(--fondo);
  display: flex; flex-direction: column;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--acento); }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; }
[hidden] { display: none !important; }

/* ---------- barra superior ---------- */
.barra {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  background: #0b3d91; color: #fff; flex: 0 0 auto; z-index: 1001;
}
.barra .titulo { flex: 1; min-width: 0; line-height: 1.25; }
.barra .titulo .sub { display: block; font-size: 12px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.18); white-space: nowrap; }
.chip.base { background: #1a7f37; }
.chip.local { background: #9a6700; }
.btn-icono { background: transparent; border: 0; color: inherit; font-size: 20px; cursor: pointer; padding: 2px 6px; }
.barra .btn { background: #fff; color: #0b3d91; border-color: #fff; }

/* ---------- layout ---------- */
.principal { flex: 1; display: flex; min-height: 0; position: relative; }
.panel {
  width: var(--panel-ancho); flex: 0 0 auto; background: var(--panel); border-right: 1px solid var(--borde);
  overflow-y: auto; padding: 0 12px 16px; z-index: 1000;
}
.panel.oculto { display: none; }
.mapa { flex: 1; min-width: 0; background: #dfe3e8; }

.pestanas { position: sticky; top: 0; display: flex; gap: 2px; background: var(--panel); padding: 8px 0; border-bottom: 1px solid var(--borde); z-index: 2; margin-bottom: 8px; }
.pestanas button { flex: 1; border: 0; background: transparent; padding: 6px 2px; border-radius: 6px; cursor: pointer; color: var(--suave); font-weight: 600; font-size: 13px; }
.pestanas button.activa { background: var(--acento); color: var(--acento-texto); }

.rotulo { display: block; font-weight: 600; margin: 8px 0 4px; }
.subtitulo { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--suave); margin: 16px 0 6px; }
.ayuda { color: var(--suave); font-size: 12.5px; margin: 6px 0; }
.fila { display: flex; gap: 6px; align-items: center; }
.fila input, .fila select { flex: 1; min-width: 0; }
.botones { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
input[type=search], input[type=text], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid var(--borde); border-radius: 6px; background: var(--fondo);
}
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--acento); outline-offset: 1px; }
.btn {
  border: 1px solid var(--borde); background: var(--fondo); padding: 6px 10px; border-radius: 6px; cursor: pointer;
  font-weight: 600; font-size: 13px; white-space: nowrap; color: var(--texto);
}
.btn:hover { border-color: var(--acento); }
.btn.primario { background: var(--acento); color: var(--acento-texto); border-color: var(--acento); }
.btn.peligro { color: var(--peligro); }
.btn.activo { outline: 2px solid var(--resalte); }

.aviso { background: #fff8c5; color: #3b2300; border: 1px solid #d4a72c; border-radius: 6px; padding: 8px; font-size: 13px; margin-bottom: 8px; }

/* ---------- resultados ---------- */
.resultados { margin: 6px 0; }
.resultados .meta { font-size: 12px; color: var(--suave); margin: 4px 0; }
.resultados .meta .motor { font-weight: 600; color: var(--ok); }
.item {
  display: flex; gap: 8px; align-items: flex-start; padding: 7px 8px; border: 1px solid var(--borde); border-radius: 6px;
  margin: 5px 0; cursor: pointer; background: var(--fondo);
}
.item:hover { border-color: var(--acento); }
.item .punto { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; margin-top: 4px; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.item .cuadro { border-radius: 2px; }
.item .cuerpo { flex: 1; min-width: 0; }
.item .nombre { font-weight: 600; }
.item .detalle { font-size: 12.5px; color: var(--suave); }
.item .dist { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.item.sin-ubicacion { border-style: dashed; cursor: default; }
.vacio { color: var(--suave); font-style: italic; padding: 6px 0; }

.organigrama ul { list-style: none; margin: 0; padding-left: 14px; border-left: 1px dashed var(--borde); }
.organigrama > ul { padding-left: 0; border: 0; }
.organigrama li { margin: 3px 0; }
.organigrama .nodo { cursor: pointer; padding: 2px 4px; border-radius: 4px; display: inline-block; }
.organigrama .nodo:hover { background: var(--fondo); }
.organigrama .nodo small { color: var(--suave); }
.organigrama .nodo.sin-ubic { cursor: default; }
.etiqueta-tipo { font-size: 11px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--borde); color: var(--suave); }
.pendiente { color: #9a6700; font-weight: 600; }

details.consulta { border: 1px solid var(--borde); border-radius: var(--radio); padding: 8px 10px; margin: 8px 0; background: var(--panel); }
details.consulta > summary { font-weight: 700; cursor: pointer; }
details.sql summary { font-size: 12px; color: var(--suave); cursor: pointer; margin-top: 6px; }
details.sql pre { background: #0d1117; color: #e6edf3; padding: 8px; border-radius: 6px; font-size: 11.5px; overflow-x: auto; white-space: pre; }

.lista-capas label, .check { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }
.muestra { width: 16px; height: 16px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.25); flex: 0 0 auto; }

/* ---------- leyenda ---------- */
.leyenda { font-size: 12.5px; }
.leyenda h4 { margin: 8px 0 2px; font-size: 12px; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; }
.leyenda .ley { display: flex; align-items: center; gap: 7px; margin: 3px 0; }
.leyenda .sim { width: 18px; height: 14px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; }
.sim-punto { width: 12px !important; height: 12px !important; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.sim-cuadro { width: 16px !important; height: 16px !important; border-radius: 3px; color: #fff; font-size: 9px; font-weight: 700; border: 1px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.sim-area { border: 2px solid; border-radius: 2px; }
.sim-linea { height: 0 !important; border-top: 3px solid; }
.sim-linea.punteada { border-top-style: dashed; }
.ley-control { background: var(--panel); color: var(--texto); padding: 8px 10px; border-radius: 6px; box-shadow: var(--sombra); max-height: 45vh; overflow-y: auto; }
.ley-control .titulo-ley { font-weight: 700; margin-bottom: 4px; display: flex; justify-content: space-between; gap: 8px; cursor: pointer; }
.ley-control.plegada .leyenda { display: none; }

/* ---------- mapa: marcadores y fichas ---------- */
.pi { width: 22px; height: 22px; border-radius: 4px; color: #fff; font: 700 10px/20px system-ui, sans-serif; text-align: center; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.45), 0 1px 3px rgba(0,0,0,.3); }
.num { width: 22px; height: 22px; border-radius: 50%; color: #fff; font: 700 11px/19px system-ui, sans-serif; text-align: center; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.45); }
.leaflet-tooltip.etiqueta { background: rgba(255,255,255,.9); border: 0; box-shadow: none; padding: 0 4px; font-weight: 600; font-size: 11px; color: #1f2328; }
.leaflet-tooltip.etiqueta::before { display: none; }
.leaflet-popup-content { margin: 12px 14px; }
.leaflet-popup-content-wrapper { border-radius: 8px; }
.ficha { font-size: 13px; min-width: 240px; color: #1f2328; }
.ficha .tipo { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: #59636e; text-transform: uppercase; letter-spacing: .03em; }
.ficha .tipo i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.ficha h3 { margin: 2px 0 8px; font-size: 16px; line-height: 1.25; }
.ficha dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 10px; margin: 0; }
.ficha dt { color: #59636e; font-weight: 600; }
.ficha dd { margin: 0; overflow-wrap: anywhere; }
.ficha ul { margin: 0; padding-left: 16px; }
.ficha .estado { margin: 8px 0 0; font-size: 12px; }
.ficha .estado.no { color: #9a6700; }
.ficha .estado.si { color: #1a7f37; }
.ficha .acciones { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.ficha .acciones button { border: 1px solid #d1d9e0; background: #f6f8fa; border-radius: 6px; padding: 4px 8px; font-size: 12px; font-weight: 600; cursor: pointer; }
/* Foto de cabecera de la ficha: vista del lugar en el recorrido 360°, panorámica 2:1.
   Es la cara frontal del cubo (cuadrada, 2×2 teselas) recortada a la franja del horizonte. */
.ficha .ficha-foto { position: relative; display: block; width: 100%; aspect-ratio: 2 / 1; padding: 0; margin: 0 0 12px; border: 0; border-radius: 8px; overflow: hidden; cursor: pointer; background: #1f2328; color: #fff; text-align: left; }
.ficha-foto .cara { position: absolute; left: 0; top: -50%; width: 100%; aspect-ratio: 1; display: grid; grid-template-columns: 1fr 1fr; transition: transform .5s ease; }
.ficha-foto .cara img { width: calc(100% + 1px); height: calc(100% + 1px); display: block; }   /* +1 px: sin rayas entre teselas */
.ficha-foto:hover .cara, .ficha-foto:focus-visible .cara { transform: scale(1.04); }
.ficha-foto .sello { position: absolute; right: 8px; top: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(13, 17, 23, .72); font-size: 12px; font-weight: 700; }
.ficha-foto .pie { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 12px 9px; background: linear-gradient(transparent, rgba(0, 0, 0, .72)); font-size: 13.5px; font-weight: 600; line-height: 1.25; }
.ficha-foto .pie small { display: block; font-size: 12px; font-weight: 500; opacity: .9; }
@media (prefers-reduced-motion: reduce) { .ficha-foto .cara { transition: none; } }

/* ---------- plano de la planta baja de la casona ---------- */
/* El plano va en un panel debajo de los datos: el lienzo de arriba deja pasar el clic (sus figuras no). */
.leaflet-overlay-pane > svg { pointer-events: none; }
.leaflet-tooltip.plano-rotulo {
  display: none; background: transparent; border: 0; box-shadow: none; padding: 0;
  color: #3b4048; font-size: 8px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  text-align: center; white-space: normal; width: max-content; line-height: 1.15;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff;
}
.leaflet-tooltip.plano-rotulo::before { display: none; }
/* Cada nombre, a lo sumo del ancho de su lugar: --m metros × ≈7 px (zoom 20) o ≈14 px (zoom 21).
   A zoom 21 la letra baja de 10,5 px hasta 7,5 px si la palabra más larga (--l letras) no entra. */
.leaflet-tooltip.plano-rotulo > span { display: block; max-width: calc(var(--m, 8) * 6.65px); }
.plano-cerca .leaflet-tooltip.plano-rotulo.desde20, .plano-muy-cerca .leaflet-tooltip.plano-rotulo { display: block; }
.plano-muy-cerca .leaflet-tooltip.plano-rotulo { letter-spacing: .04em; }
.plano-muy-cerca .leaflet-tooltip.plano-rotulo > span {
  max-width: calc(var(--m, 8) * 13.3px);
  font-size: clamp(7.5px, calc(var(--m, 8) * 13.3px / (var(--l, 8) * 0.76)), 10.5px);
}
.leaflet-tooltip.plano-rotulo.patio { color: #4f6b42; font-style: italic; font-weight: 600; text-transform: none; letter-spacing: 0; font-size: 10px; }
.plano-muy-cerca .leaflet-tooltip.plano-rotulo.patio { letter-spacing: 0; }
.plano-muy-cerca .leaflet-tooltip.plano-rotulo.patio > span { font-size: 12.5px; max-width: none; }

/* ---------- ficha del elemento seleccionado, en el panel (como los mapas de campus) ---------- */
.panel.con-ficha > :not(.ficha-panel) { display: none !important; }
.ficha-panel { margin: 0 -12px; outline: none; }
.ficha-panel-cab { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 6px; padding: 10px 8px 10px 16px; background: var(--panel); border-bottom: 1px solid var(--borde); }
.ficha-panel-cab strong { flex: 1; font-size: 15px; }
.btn-texto { border: 1px solid var(--borde); background: transparent; color: var(--texto); border-radius: 6px; padding: 4px 10px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn-texto:hover { border-color: var(--acento); color: var(--acento); }
.ficha-panel-cab .btn-icono { font-size: 24px; line-height: 1; color: var(--suave); }
.ficha-panel-cab .btn-icono:hover { color: var(--texto); }
#ficha-panel-cuerpo { padding: 14px 16px 18px; }
.ficha-panel .ficha { font-size: 14px; min-width: 0; color: var(--texto); }
.ficha-panel .ficha .tipo, .ficha-panel .ficha dt { color: var(--suave); }
.ficha-panel .ficha h3 { font-size: 20px; margin: 4px 0 14px; }
.ficha-panel .ficha dl { gap: 7px 14px; }
.ficha-panel .ficha .acciones { gap: 8px; margin-top: 14px; }
.ficha-panel .ficha .acciones button { background: var(--fondo); border-color: var(--borde); color: var(--texto); padding: 7px 12px; font-size: 13px; }
.ficha-panel .ficha .acciones button:hover { border-color: var(--acento); color: var(--acento); }
/* Controles del mapa: selector de planta y «Mi ubicación» */
.metadatos dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px; margin: 8px 0 0; font-size: 12px; }
.metadatos dt { font-weight: 600; color: var(--suave); }
.metadatos dd { margin: 0; }
.pisos { display: flex; background: #fff; }
.pisos button { border: 0; border-right: 1px solid #ccc; background: #fff; color: #1f2328; padding: 0 9px; height: 30px; font: 600 12px/30px system-ui, sans-serif; cursor: pointer; }
.pisos button:last-child { border-right: 0; }
.pisos button:hover { background: #f4f4f4; }
.pisos button[aria-pressed="true"] { background: #0969da; color: #fff; }
.ubicarme a { display: grid !important; place-items: center; color: #1f2328; }
.coords { background: rgba(255,255,255,.85); padding: 1px 6px; font: 11px ui-monospace, Consolas, monospace; color: #1f2328; border-radius: 3px; }
.norte { background: rgba(255,255,255,.9); width: 34px; height: 44px; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.3); display: flex; flex-direction: column; align-items: center; justify-content: center; font: 700 12px system-ui; color: #1f2328; }
.norte svg { width: 18px; height: 22px; }
.reticula-etq { font: 10px ui-monospace, Consolas, monospace; color: #1f2328; background: rgba(255,255,255,.8); padding: 0 2px; white-space: nowrap; }

/* ---------- tablas ---------- */
.tabla-envoltura { overflow-x: auto; border: 1px solid var(--borde); border-radius: 6px; }
.tabla { border-collapse: collapse; width: 100%; font-size: 12px; }
.tabla th, .tabla td { border-bottom: 1px solid var(--borde); padding: 4px 6px; text-align: left; vertical-align: top; }
.tabla th { background: var(--fondo); position: sticky; top: 0; }
.tabla td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla tbody tr { cursor: pointer; }
.tabla tbody tr:hover { background: var(--fondo); }

/* ---------- edición ---------- */
.formulario { border: 1px solid var(--acento); border-radius: var(--radio); padding: 10px; margin: 8px 0; }
.formulario h4 { margin: 0 0 6px; }
.formulario label { display: block; font-size: 12px; font-weight: 600; color: var(--suave); margin: 6px 0 2px; }
.formulario textarea { min-height: 56px; resize: vertical; }
.formulario .error { color: var(--peligro); font-size: 12px; font-weight: 600; }
.dibujo { background: #fff8c5; color: #3b2300; border: 1px solid #d4a72c; border-radius: 6px; padding: 8px; font-size: 13px; }
.dibujo .medida { font-weight: 700; font-variant-numeric: tabular-nums; }
.borrador-tag { font-size: 11px; font-weight: 700; color: #9a6700; }
.formulario .geom { font-size: 12px; color: var(--suave); margin: 0 0 4px; font-variant-numeric: tabular-nums; }
.formulario .campo-codigo { display: flex; gap: 6px; }
.formulario .campo-codigo input { flex: 1; min-width: 0; }
.formulario input, .formulario select, .formulario textarea { width: 100%; }
.formulario .campo-codigo input { width: auto; }
.formulario input[readonly] { background: var(--fondo); color: var(--suave); }
.btn.mini { padding: 2px 8px; font-size: 12px; }
.acciones-borrador { display: flex; gap: 4px; align-items: center; flex: 0 0 auto; }
#lista-borradores .item { cursor: default; }
.borrador-accion { font-size: 11px; font-weight: 700; text-transform: uppercase; }
.borrador-accion.nuevo { color: #1a7f37; }
.borrador-accion.editado { color: #9a6700; }
.borrador-accion.eliminado { color: var(--peligro); }
.barra-dibujo {
  position: absolute; z-index: 1000; top: 10px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 120px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; background: #fff8c5; color: #3b2300; border: 1px solid #d4a72c;
  border-radius: 8px; padding: 6px 8px; font-size: 13px; box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.barra-dibujo .medida { font-weight: 700; font-variant-numeric: tabular-nums; }
.barra-dibujo .snap { color: #1a7f37; font-weight: 600; font-size: 12px; }
.barra-dibujo button { padding: 3px 9px; border-radius: 6px; border: 1px solid #d4a72c; background: #fff; color: #3b2300; cursor: pointer; font-weight: 600; }
.barra-dibujo button.ok { background: #1a7f37; border-color: #1a7f37; color: #fff; }
.leaflet-container.dibujando, .leaflet-container.dibujando .leaflet-interactive { cursor: crosshair; }
@media (max-width: 760px) { .barra-dibujo { top: auto; bottom: 28px; max-width: calc(100% - 20px); } }

/* ---------- plano ---------- */
.plano { position: fixed; inset: 0; background: #e6e9ed; z-index: 5000; overflow: auto; padding: 16px; color: #1f2328; color-scheme: light; }
.plano .btn:not(.primario) { background: #fff; color: #1f2328; border-color: #d1d9e0; }
.plano-botones { display: flex; gap: 8px; justify-content: center; margin-bottom: 12px; }
.plano-hoja { background: #fff; max-width: 1100px; margin: 0 auto; padding: 18px 22px; box-shadow: 0 2px 10px rgba(0,0,0,.2); border: 2px solid #1f2328; }
.plano-cabecera { display: flex; justify-content: space-between; gap: 16px; border-bottom: 2px solid #1f2328; padding-bottom: 8px; margin-bottom: 10px; }
.plano-cabecera h1 { font-size: 20px; margin: 0; }
.plano-cabecera p { margin: 2px 0 0; color: #59636e; }
.plano-sello { font-size: 11px; text-align: right; color: #59636e; max-width: 220px; }
.plano-cuerpo { display: grid; grid-template-columns: 1fr 250px; gap: 12px; }
.plano-mapa { height: 520px; border: 1px solid #1f2328; background: #f0f0f0; }
.plano-lateral h2, .plano-hoja > h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; margin: 4px 0 6px; border-bottom: 1px solid #d1d9e0; }
.plano-hoja > h2 { margin-top: 14px; }
.plano-datos { font-size: 11.5px; margin: 0; }
.plano-datos dt { font-weight: 700; margin-top: 4px; }
.plano-datos dd { margin: 0; }
#plano-integrantes { min-height: 1.4em; border-bottom: 1px dotted #8c959f; outline: none; }
#plano-integrantes:empty::before { content: "(escriba aquí los nombres)"; color: #8c959f; }
.plano-tabla { font-size: 10.5px; }
.plano-tabla tbody tr { cursor: default; }
.plano-nota { font-size: 10.5px; color: #59636e; margin: 6px 0 0; }

/* ---------- celular ---------- */
@media (max-width: 760px) {
  .barra .titulo { font-size: 13px; }
  .barra .titulo .sub { display: none; }
  .panel {
    position: absolute; left: 0; right: 0; bottom: 0; width: auto; max-height: 55%;
    border-right: 0; border-top: 1px solid var(--borde); box-shadow: var(--sombra); border-radius: 12px 12px 0 0;
  }
  .mapa .leaflet-bottom { bottom: var(--hoja, 0px); }
  .plano { padding: 8px; }
  .plano-cuerpo { grid-template-columns: 1fr; }
  .plano-mapa { height: 380px; }
  .plano-cabecera { flex-direction: column; }
  .plano-sello { text-align: left; max-width: none; }
}

/* ---------- impresión: solo el plano ---------- */
@media print {
  @page { size: A4 landscape; margin: 8mm; }
  body > *:not(#plano) { display: none !important; }
  .plano { position: static; padding: 0; background: #fff; overflow: visible; }
  .plano-botones { display: none; }
  .plano-hoja { box-shadow: none; max-width: none; padding: 8px 12px; }
  .plano-mapa { height: 125mm; }
  .plano-tabla { page-break-inside: auto; }
  .plano-tabla tr { page-break-inside: avoid; }
  #plano-integrantes:empty::before { content: ""; }
}

/* Recorrido virtual 360° (visor propio, js/visor360.js) */
.recorrido { position: fixed; inset: 0; z-index: 5000; display: flex; flex-direction: column; background: #0d1117; color: #e6edf3; color-scheme: dark; }
.recorrido[hidden] { display: none; }
.recorrido-barra { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; background: #161b22; border-bottom: 1px solid #30363d; }
.recorrido-barra strong { margin-right: auto; }
.recorrido-barra select { max-width: min(60vw, 380px); padding: 5px 8px; border-radius: 6px; border: 1px solid #30363d; background: #0d1117; color: #e6edf3; }
.recorrido-barra .btn { background: #21262d; color: #e6edf3; border-color: #30363d; text-decoration: none; }
.recorrido-nav { display: inline-flex; gap: 4px; align-items: center; }
.recorrido-nav .btn { padding: 4px 10px; font-size: 16px; line-height: 1; }
.recorrido-nav .btn:disabled { opacity: .4; cursor: default; }
.recorrido-centro { position: relative; flex: 1; display: flex; min-height: 0; }
/* Nombre de la escena arriba a la izquierda (convención de los recorridos de museos) */
.recorrido-info { position: absolute; left: 12px; top: 10px; z-index: 2; max-width: calc(100% - 80px); padding: 4px 10px; border-radius: 4px;
  background: rgba(13, 17, 23, .6); font-size: 13px; color: #e6edf3; pointer-events: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recorrido-ficha { position: absolute; right: 60px; top: 10px; bottom: 10px; z-index: 3; width: min(340px, calc(100% - 80px)); display: flex; flex-direction: column;
  background: #fff; color: #1f2328; border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .35); overflow: hidden; }
.recorrido-ficha[hidden] { display: none; }
.recorrido-ficha-cab { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid #d1d9e0; }
.recorrido-ficha-cab button { border: 0; background: none; font-size: 22px; line-height: 1; cursor: pointer; color: #59636e; }
#ficha-360-cuerpo { flex: 1; overflow-y: auto; padding: 10px 12px; }
.recorrido-ficha-zona { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: #0969da; }
.recorrido-ficha-nota { margin: 0 0 10px; font-size: 12px; color: #59636e; }
#btn-mapa-360 { margin: 8px 12px 12px; }
.recorrido-barra .btn[aria-pressed="true"] { border-color: #58a6ff; color: #58a6ff; }
.recorrido-salas { display: flex; gap: 8px; overflow-x: auto; padding: 8px 12px; background: #161b22; border-top: 1px solid #30363d; scrollbar-width: thin; }
.recorrido-salas[hidden] { display: none; }
.recorrido-salas button { flex: 0 0 132px; display: flex; flex-direction: column; gap: 2px; padding: 0 0 6px; text-align: left; cursor: pointer;
  background: #0d1117; color: #e6edf3; border: 1px solid #30363d; border-radius: 6px; overflow: hidden; font: inherit; }
.recorrido-salas button:hover, .recorrido-salas button:focus-visible { border-color: #58a6ff; }
.recorrido-salas button.activa { border-color: #58a6ff; box-shadow: 0 0 0 1px #58a6ff; }
.recorrido-salas img { width: 100%; height: 66px; object-fit: cover; display: block; background: #21262d; }
.recorrido-salas span { padding: 0 6px; font-size: 12px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recorrido-salas small { padding: 0 6px; font-size: 11px; color: #9198a1; }
.recorrido-credito { margin: 0; padding: 5px 12px; font-size: 12px; color: #9198a1; }
.recorrido-credito a { color: #58a6ff; }
@media (max-width: 600px) {
  .recorrido-barra strong { display: none; }
  .recorrido-nav { width: 100%; }
  .recorrido-barra select { flex: 1; max-width: none; }
  .recorrido-barra .btn { padding: 5px 8px; font-size: 13px; }
}

/* Visor: cubo de 6 caras con transformaciones CSS 3D */
.v360 { position: relative; flex: 1; overflow: hidden; background: #000; cursor: grab; touch-action: none; user-select: none; outline: none; }
.v360:active { cursor: grabbing; }
.v360:focus-visible { box-shadow: inset 0 0 0 2px #58a6ff; }
.v360-camara { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; }
.v360-cubo { position: absolute; left: 0; top: 0; transform-style: preserve-3d; }
.v360-marcas { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.v360-marca.cartel { pointer-events: none; }
.v360-marca.ir { pointer-events: auto; }
/* 1026 px en vez de 1024: 1 px de solape en cada borde para que no se vean las uniones */
.v360-cara { position: absolute; width: 1026px; height: 1026px; left: -513px; top: -513px; }
.v360-cara img { position: absolute; width: 50%; height: 50%; display: block; pointer-events: none; }
.v360-marca { position: absolute; left: 0; top: 0; transform-style: flat; display: flex; flex-direction: column; align-items: center; gap: 4px;
  font: 600 15px/1.2 system-ui, sans-serif; color: #fff; text-shadow: 0 1px 3px #000; white-space: nowrap; }
.v360-marca.ir { background: none; border: 0; padding: 4px; cursor: pointer; }
.v360-flecha { display: grid; place-items: center; width: 54px; height: 54px; border-radius: 50%; background: rgba(13, 17, 23, .55);
  border: 2px solid rgba(255, 255, 255, .85); font-size: 28px; transform: rotate(-90deg); transition: background .15s, transform .15s; }
.v360-marca.ir:hover .v360-flecha, .v360-marca.ir:focus-visible .v360-flecha { background: rgba(31, 111, 235, .85); transform: rotate(-90deg) scale(1.1); }
.v360-marca .v360-txt { background: rgba(13, 17, 23, .7); padding: 3px 8px; border-radius: 4px; font-size: 13px; }
.v360-marca.cartel .v360-txt { font-size: 14px; letter-spacing: .04em; border: 1px solid rgba(255, 255, 255, .3); }
.v360-zoom { position: absolute; right: 12px; bottom: 44px; display: flex; flex-direction: column; gap: 4px; }
.v360-zoom button { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 6px; border: 1px solid #30363d; background: rgba(22, 27, 34, .85); color: #e6edf3; font-size: 20px; cursor: pointer; }
.v360-zoom button:hover, .v360-zoom button:focus-visible { background: #1f6feb; }
.v360-zoom button[aria-pressed="true"] { border-color: #58a6ff; color: #58a6ff; }
.v360-zoom button[aria-pressed="true"]:hover { color: #fff; }
.v360-ayuda { position: absolute; left: 50%; bottom: 10px; translate: -50% 0; padding: 4px 10px; border-radius: 4px; background: rgba(13, 17, 23, .6);
  font-size: 12px; color: #c9d1d9; pointer-events: none; white-space: nowrap; transition: opacity .6s; }
.v360.usado .v360-ayuda { opacity: 0; }
.v360.cargando::after { content: 'Cargando…'; position: absolute; left: 50%; top: 50%; translate: -50% -50%; padding: 6px 12px; border-radius: 4px;
  background: rgba(13, 17, 23, .75); color: #e6edf3; font-size: 13px; }
@media (max-width: 600px) { .v360-ayuda { white-space: normal; width: 90%; text-align: center; } }
