:root {
  --fondo: rgba(18, 22, 28, 0.86);
  --fondo-solido: #12161c;
  --borde: rgba(255, 255, 255, 0.09);
  --texto: #eef1f5;
  --tenue: #9aa4b2;
  --acento: #3fa3ff;
  --acento-2: #1e6fd0;
  --verde: #3ecf8e;
  --ambar: #f5b53f;
  --gris: #7b8594;
  --radio: 14px;
  --sombra: 0 10px 30px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0e12; color: var(--texto);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
#cesium { position: fixed; inset: 0; }
.cesium-viewer-bottom { left: auto !important; right: 12px; bottom: 54px !important; }
.cesium-credit-logoContainer { display: none !important; }

button { font: inherit; color: inherit; cursor: pointer; }
.oculto { display: none !important; }
.tenue { color: var(--tenue); }

.tarjeta {
  position: fixed; z-index: 5; background: var(--fondo); backdrop-filter: blur(12px);
  border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra);
}

.icono {
  width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px;
  background: transparent; border: 0; font-size: 17px;
}
.icono:hover { background: rgba(255, 255, 255, 0.08); }
.icono.activo { background: var(--acento-2); }

/* ---------- lateral ---------- */
#lateral { top: 12px; left: 12px; bottom: 12px; width: 320px; display: flex; flex-direction: column; padding: 14px; gap: 10px; }
.marca { display: flex; align-items: center; gap: 10px; }
.marca h1 { font-size: 16px; margin: 0; font-weight: 700; letter-spacing: 0.2px; }
.marca p { margin: 0; font-size: 12px; }
.marca-logo { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 12px;
  background: linear-gradient(135deg, var(--acento), var(--acento-2)); }
.marca .icono { margin-left: auto; }

#buscar { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--borde); background: rgba(255, 255, 255, 0.05);
  color: var(--texto); font: inherit; outline: none; }
#buscar:focus { border-color: var(--acento); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { padding: 4px 10px; border-radius: 99px; border: 1px solid var(--borde); background: transparent; font-size: 12px; color: var(--tenue); }
.chips button.activo { background: rgba(63, 163, 255, 0.15); border-color: var(--acento); color: var(--texto); }

.lista { list-style: none; margin: 0 -6px; padding: 0; overflow-y: auto; flex: 1; }
.lista li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer; }
.lista li:hover { background: rgba(255, 255, 255, 0.06); }
.lista li.sel { background: rgba(63, 163, 255, 0.16); }
.lista li span { flex: 1; }

.punto { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; margin-right: 6px; }
.lista .punto { margin-right: 0; }
.punto.publicado { background: var(--verde); }
.punto.en_proceso { background: var(--ambar); }
.punto.sin_modelo { background: var(--gris); }
.leyenda { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; border-top: 1px solid var(--borde); padding-top: 10px; }

#btn-desplegar { top: 12px; left: 12px; }

/* ---------- ficha ---------- */
#ficha { top: 12px; right: 64px; width: 360px; max-height: calc(100% - 70px); overflow-y: auto; }
#ficha .cerrar { position: absolute; top: 8px; right: 8px; z-index: 2; background: rgba(0, 0, 0, 0.45); }
.fotos { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--radio) var(--radio) 0 0; }
.fotos:empty { display: none; }
.fotos figure { margin: 0; flex: 0 0 100%; scroll-snap-align: start; position: relative; }
.fotos img { width: 100%; height: 200px; object-fit: cover; display: block; }
.fotos figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 12px 8px; font-size: 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); }
.ficha-cuerpo { padding: 16px; }
.ficha-cuerpo h2 { margin: 2px 0 6px; font-size: 19px; line-height: 1.25; }
.etiqueta { margin: 0; font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--acento); font-weight: 600; }
.estado { margin: 0 0 10px; font-size: 12px; color: var(--tenue); display: flex; align-items: center; }
#ficha-desc:empty { display: none; }
.datos { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 12px 0; font-size: 13px; }
.datos dt { color: var(--tenue); }
.datos dd { margin: 0; }
.acciones { display: flex; gap: 8px; margin-top: 14px; }
.boton { padding: 9px 14px; border-radius: 10px; border: 0; background: var(--acento-2); font-weight: 600; }
.boton:hover { background: var(--acento); }
.boton.secundario { background: rgba(255, 255, 255, 0.08); }
.boton.secundario:hover { background: rgba(255, 255, 255, 0.14); }

/* ---------- herramientas y capas ---------- */
#herramientas { top: 12px; right: 12px; padding: 5px; display: flex; flex-direction: column; gap: 2px; }
#panel-capas { top: 12px; right: 64px; width: 260px; padding: 12px 16px 14px; }
#panel-capas h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--tenue); margin: 10px 0 6px; }
#panel-capas h3:first-child { margin-top: 0; }
#panel-capas label { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
#panel-capas .rango { flex-wrap: wrap; }
#panel-capas input[type=range] { flex: 1; accent-color: var(--acento); }

#coordenadas { left: 344px; bottom: 12px; padding: 6px 12px; font-size: 12px; font-variant-numeric: tabular-nums; }
#aviso-caminar { left: 50%; transform: translateX(-50%); bottom: 56px; padding: 8px 14px; font-size: 13px; }
kbd { display: inline-block; min-width: 20px; padding: 1px 5px; margin: 0 1px; border-radius: 5px; border: 1px solid var(--borde);
  background: rgba(255, 255, 255, 0.08); font: 600 11px Inter, sans-serif; text-align: center; }

body.plegado #coordenadas { left: 12px; }

#tip { position: fixed; z-index: 6; pointer-events: none; padding: 3px 8px; border-radius: 6px; font-size: 12px;
  background: rgba(18, 22, 28, 0.85); border: 1px solid var(--borde); white-space: nowrap; }

/* ---------- modo edición (solo local) ---------- */
#panel-editor { left: 12px; top: 12px; bottom: 12px; width: 340px; padding: 14px; overflow-y: auto; }
body.editando #lateral, body.editando #btn-desplegar { display: none !important; }
body.editando #coordenadas { left: 364px; }
.editor-cab { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.editor-cab h3 { margin: 0; font-size: 15px; }
.insignia { font-size: 11px; padding: 2px 8px; border-radius: 99px; background: rgba(245, 181, 63, 0.18); color: var(--ambar); }
.ed-titulo { margin: 0 0 10px; font-weight: 600; font-size: 14px; }
.pestanas { display: flex; gap: 4px; background: rgba(255, 255, 255, 0.05); padding: 3px; border-radius: 10px; margin-bottom: 12px; }
.pestanas button { flex: 1; padding: 6px; border: 0; border-radius: 8px; background: transparent; color: var(--tenue); font-size: 13px; }
.pestanas button.activo { background: var(--acento-2); color: var(--texto); }
#panel-editor label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--tenue); margin-bottom: 8px; }
#panel-editor input, #panel-editor select, #panel-editor textarea { font: inherit; font-size: 13px; color: var(--texto); background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--borde); border-radius: 8px; padding: 6px 8px; font-variant-numeric: tabular-nums; width: 100%; min-width: 0; }
#panel-editor textarea { resize: vertical; line-height: 1.45; }
#panel-editor input:focus, #panel-editor select:focus, #panel-editor textarea:focus { outline: none; border-color: var(--acento); }
#panel-editor select option { background: var(--fondo-solido); }
.pasos select { width: auto !important; }
.rejilla { display: grid; grid-template-columns: 1fr 1fr; gap: 0 8px; }
.sub-cab { display: flex; align-items: center; justify-content: space-between; font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--tenue); margin: 14px 0 6px; font-weight: 600; }
.mini { font: 600 11px Inter, sans-serif; text-transform: none; letter-spacing: 0; padding: 4px 9px; border-radius: 7px;
  border: 1px solid var(--borde); background: rgba(255, 255, 255, 0.06); color: var(--texto); cursor: pointer; }
.mini:hover { border-color: var(--acento); }
#panel-editor label.boton-archivo { display: inline-block; margin: 0; color: var(--texto); font-size: 11px; }
.filas-datos { display: flex; flex-direction: column; gap: 6px; }
.fila-dato { display: grid; grid-template-columns: 1fr 1.3fr auto; gap: 6px; }
.quitar { border: 0; background: transparent; color: var(--tenue); font-size: 15px; padding: 0 4px; cursor: pointer; }
.quitar:hover { color: #ff6b6b; }
.fotos-edit { display: flex; flex-direction: column; gap: 8px; }
.fotos-edit:empty::before { content: "Aún no hay fotos."; color: var(--tenue); font-size: 12px; }
.foto-item { display: grid; grid-template-columns: 72px 1fr; gap: 8px; align-items: start; }
.foto-item img { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; }
.foto-item input { margin-bottom: 4px; }
.foto-botones { display: flex; gap: 4px; }
.subiendo { font-size: 12px; color: var(--acento); }
.ayuda { font-size: 11px; margin: 4px 0 0; }
.ancho { width: 100%; }
.cruceta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.cruceta button { padding: 8px 4px; border-radius: 8px; border: 1px solid var(--borde); background: rgba(255, 255, 255, 0.06); font-size: 13px; }
.cruceta button:hover { background: rgba(63, 163, 255, 0.2); border-color: var(--acento); }
.pasos { margin: 2px 0 8px; font-size: 12px; color: var(--tenue); display: flex; align-items: center; gap: 8px; }
.nota { font-size: 12px; color: var(--ambar); margin: 8px 0 0; }
.nota:empty { display: none; }
.pie-editor { position: sticky; bottom: -14px; background: var(--fondo-solido); padding: 10px 0 4px; margin-top: 14px; }
#ed-estado { font-size: 12px; margin: 6px 0 0; }
#ed-estado:empty { display: none; }
body.reubicando #cesium { cursor: crosshair; }

#btn-vista-inicial { right: 12px; bottom: 12px; padding: 8px 14px; border-radius: 10px; font-weight: 600; font-size: 13px;
  color: var(--texto); cursor: pointer; }
#btn-vista-inicial:hover { background: var(--acento-2); }
#panel-capas select { font: inherit; font-size: 13px; color: var(--texto); background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--borde); border-radius: 8px; padding: 5px 8px; width: 100%; margin-top: 4px; }
#panel-capas select option { background: var(--fondo-solido); }
#panel-capas { max-height: calc(100% - 24px); overflow-y: auto; }
#aviso-velocidad { left: 50%; top: 18px; transform: translateX(-50%); padding: 6px 14px; font-weight: 600; font-size: 13px; }
#ayuda-nav { left: 50%; transform: translateX(-50%); bottom: 12px; padding: 6px 12px; font-size: 12px; }
body.caminando #ayuda-nav { display: none; }

/* ---------- móvil ---------- */
@media (max-width: 760px) {
  #lateral { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 44%; }
  #ficha { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; max-height: 60%; }
  #panel-capas { right: 60px; top: 8px; width: auto; left: 8px; }
  #herramientas { top: 8px; right: 8px; }
  #coordenadas, #ayuda-nav { display: none; }
  #panel-editor { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; height: 60%; }
  .fotos img { height: 160px; }
}
