* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', Tahoma, sans-serif;
  background: #111;
  color: #eee;
  overflow: hidden;
}

.oculto { display: none !important; }

/* ── MAPA ── */
#map {
  width: 100vw;
  height: 100vh;
  background: #111111;
}

/* ── BARRA DE SESIÓN ── */
#barra-sesion {
  position: fixed;
  bottom: 26px; right: 12px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(22, 33, 62, 0.92);
  border: 1px solid #0f3460;
  border-radius: 22px;
  padding: 7px 16px;
  backdrop-filter: blur(6px);
}

#info-usuario { font-size: 0.82rem; color: #aaa; }

#btn-login {
  background: #4285F4;
  color: white;
  border: none;
  padding: 7px 15px;
  border-radius: 16px;
  font-size: 0.82rem;
  cursor: pointer;
  font-weight: bold;
}
#btn-login:hover { background: #3367d6; }

#btn-logout {
  background: transparent;
  border: 1px solid #444;
  color: #888;
  padding: 5px 12px;
  border-radius: 14px;
  font-size: 0.78rem;
  cursor: pointer;
}
#btn-logout:hover { border-color: #e94560; color: #e94560; }

/* ── PANEL LATERAL ── */
#panel {
  position: fixed;
  top: 90px;
  left: 20px;
  width: 544px;
  max-height: calc(100vh - 110px);
  background: #16213e;
  border: 2px solid #0f3460;
  border-radius: 16px;
  overflow: hidden;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
  box-shadow: 0 8px 32px rgba(0,0,0,0.6);
  min-width: 260px;
  max-width: 860px;
}

#panel-scroll {
  height: 100%;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 20px 24px;
  box-sizing: border-box;
  padding-right: 12px;
}

#panel-scroll::-webkit-scrollbar { width: 4px; }
#panel-scroll::-webkit-scrollbar-track {
  background: rgba(15, 52, 96, 0.3);
  border-radius: 0 14px 14px 0;
  margin: 2px 0;
}
#panel-scroll::-webkit-scrollbar-thumb {
  background: #4285F4;
  border-radius: 10px;
}
#panel-scroll::-webkit-scrollbar-thumb:hover { background: #6aa3f8; }
#panel-scroll { scrollbar-width: thin; scrollbar-color: #4285F4 transparent; }

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

/* ── ASA DE REDIMENSIÓN ── */
#panel-resize-handle {
  position: absolute;
  top: 0;
  right: 0;
  width: 8px;
  height: 100%;
  cursor: ew-resize;
  border-radius: 0 16px 16px 0;
  background: transparent;
  transition: background 0.2s;
  z-index: 10;
}

#panel-resize-handle:hover,
#panel-resize-handle:active {
  background: rgba(66, 133, 244, 0.25);
}

/* Pequeña línea visual indicativa */
#panel-resize-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 32px;
  background: rgba(66, 133, 244, 0.4);
  border-radius: 2px;
  opacity: 0;
  transition: opacity 0.2s;
}
#panel-resize-handle:hover::after { opacity: 1; }

.btn-cerrar {
  position: absolute;
  top: 14px; right: 14px;
  background: #0f3460;
  border: none;
  color: #fff;
  width: 34px; height: 34px;
  border-radius: 50%;
  font-size: 15px;
  cursor: pointer;
}
.btn-cerrar:hover { background: #e94560; }

#panel-contenido h2 { font-size: 1.4rem; color: #ffffff; margin-bottom: 6px; padding-right: 40px; }
#panel-contenido .categoria { font-size: 0.82rem; color: #4285F4; margin-bottom: 12px; letter-spacing: 0.03em; }
#panel-contenido .descripcion {
  color: #bbb;
  line-height: 1.7;
  margin-bottom: 15px;
  white-space: pre-wrap;
  word-break: break-word;
}
#panel-contenido .fecha { font-size: 0.78rem; color: #555; margin-bottom: 8px; }
#panel-contenido .autor { font-size: 0.8rem; color: #4285F4; margin-top: 0; padding-top: 14px; border-top: 1px solid #0f3460; }

.fotos-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}
.fotos-grid img {
  width: 100%;
  object-fit: cover;
  border-radius: 7px;
  cursor: pointer;
  transition: transform 0.15s;
}
.fotos-grid img:hover { transform: scale(1.01); }

/* ── BOTONES DE ACCIÓN ── */
.btns-accion {
  display: flex;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.btn-editar {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 1px solid #4285F4;
  color: #4285F4;
  padding: 9px 6px;
  border-radius: 9px;
  font-size: 0.80rem;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
}
.btn-editar:hover { background: #4285F4; color: #fff; }

.btn-borrar {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 1px solid #e94560;
  color: #e94560;
  padding: 9px 6px;
  border-radius: 9px;
  font-size: 0.80rem;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
}
.btn-borrar:hover { background: #e94560; color: #fff; }

.btn-mover {
  flex: 1.5;
  min-width: 0;
  background: transparent;
  border: 1px solid #4285F4;
  color: #4285F4;
  padding: 9px 6px;
  border-radius: 9px;
  font-size: 0.80rem;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
}
.btn-mover:hover { background: #4285F4; color: #fff; }

.btn-tamaño {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 1px solid #4285F4;
  color: #4285F4;
  padding: 9px 6px;
  border-radius: 9px;
  font-size: 0.80rem;
  cursor: pointer;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
}
.btn-tamaño:hover { background: #4285F4; color: #fff; }

/* ── BOTÓN AÑADIR PIN ── */
#btn-añadir {
  position: fixed;
  bottom: 78px; right: 12px;
  background: #e94560;
  color: #fff; border: none;
  padding: 13px 28px; border-radius: 30px;
  font-size: 0.95rem; font-weight: bold;
  cursor: pointer; z-index: 1000;
  box-shadow: 0 4px 18px rgba(233,69,96,0.45);
  transition: all 0.2s;
}
#btn-añadir:hover { background: #c73652; transform: scale(1.05); }

/* ── INSTRUCCIÓN ── */
#instruccion {
  position: fixed;
  top: 18px; left: 50%;
  transform: translateX(-50%);
  background: #0f3460; color: #fff;
  padding: 11px 22px; border-radius: 20px;
  z-index: 1000; display: flex;
  align-items: center; gap: 14px;
  font-size: 0.9rem;
  box-shadow: 0 3px 12px rgba(0,0,0,0.4);
}
#instruccion button {
  background: #e94560; border: none; color: #fff;
  padding: 5px 13px; border-radius: 13px;
  cursor: pointer; font-size: 0.85rem;
}

/* ── EDITOR DE TEXTO ENRIQUECIDO ── */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #0a2240;
  border: 1px solid #1a4a8a;
  border-bottom: none;
  border-radius: 7px 7px 0 0;
  padding: 5px 8px;
  flex-wrap: nowrap;
}

.editor-toolbar button {
  background: transparent;
  border: 1px solid transparent;
  color: #bbb;
  width: 28px; height: 26px;
  border-radius: 5px;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  padding: 0;
  flex-shrink: 0;
}
.editor-toolbar button:hover {
  background: #1a4a8a;
  border-color: #4285F4;
  color: #fff;
}

.editor-toolbar button.activo {
  background: #1a4a8a;
  border-color: #4285F4;
  color: #fff;
}

.toolbar-sep {
  width: 1px;
  height: 18px;
  background: #1a4a8a;
  margin: 0 4px;
  flex-shrink: 0;
}

.editor-toolbar select {
  background: transparent;
  border: 1px solid transparent;
  color: #bbb;
  font-size: 0.72rem;
  border-radius: 5px;
  padding: 2px 2px;
  cursor: pointer;
  outline: none;
  transition: background 0.15s, border-color 0.15s;
  max-width: 105px;
}
.editor-toolbar select:hover,
.editor-toolbar select:focus {
  background: #1a4a8a;
  border-color: #4285F4;
  color: #fff;
}
.editor-toolbar select option {
  background: #16213e;
  color: #eee;
}

.editor-content {
  width: 100%;
  min-height: 90px;
  background: #0f3460;
  border: 1px solid #1a4a8a;
  border-radius: 0 0 7px 7px;
  color: #fff;
  padding: 9px 11px;
  font-size: 0.92rem;
  outline: none;
  line-height: 1.6;
  word-break: break-word;
  overflow-y: auto;
  max-height: 200px;
  /* Estilos internos del rich text */
}

/* Placeholder para contenteditable */
.editor-content:empty::before {
  content: attr(data-placeholder);
  color: #555;
  pointer-events: none;
}

/* Estilos que el execCommand genera dentro del editor */
.editor-content b, .editor-content strong { font-weight: bold; }
.editor-content i, .editor-content em     { font-style: italic; }
.editor-content u                         { text-decoration: underline; }

/* ── MODAL NUEVA MARCA ── */
#modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 2000; display: flex;
  align-items: center; justify-content: center;
}

#modal-caja {
  background: #16213e;
  border: 2px solid #0f3460;
  border-radius: 14px; padding: 28px;
  width: 90%; max-width: 460px;
  max-height: 88vh; overflow-y: auto;
}

#modal-caja h2 { color: #e94560; margin-bottom: 18px; font-size: 1.3rem; }

#modal-caja label {
  display: block; margin: 12px 0 5px;
  color: #999; font-size: 0.85rem;
}

#modal-caja input[type="text"] {
  width: 100%; background: #0f3460;
  border: 1px solid #1a4a8a; border-radius: 7px;
  color: #fff; padding: 9px 11px;
  font-size: 0.92rem; outline: none;
}
#modal-caja select {
  width: 100%; background: #0f3460;
  border: 1px solid #1a4a8a; border-radius: 7px;
  color: #fff; padding: 9px 11px;
  font-size: 0.92rem; outline: none; cursor: pointer;
}
#modal-caja select option { background: #16213e; }
#modal-caja input[type="file"] { margin-top: 4px; color: #888; font-size: 0.85rem; }

#preview-fotos { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
#preview-fotos img { width: 65px; height: 65px; object-fit: cover; border-radius: 5px; }

#progreso-caja {
  margin-top: 12px; background: #0f3460;
  border-radius: 8px; overflow: hidden;
}
#progreso-barra { height: 7px; background: #e94560; width: 0%; transition: width 0.3s; }
#progreso-texto { display: block; text-align: center; font-size: 0.78rem; color: #888; padding: 5px; }

#btn-guardar {
  background: #e94560; color: #fff; border: none;
  padding: 12px; border-radius: 9px;
  font-size: 0.95rem; font-weight: bold;
  cursor: pointer; margin-top: 18px; width: 100%;
}
#btn-guardar:hover { background: #c73652; }
#btn-guardar:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secundario {
  background: transparent; border: 1px solid #333;
  color: #888; padding: 9px; border-radius: 9px;
  font-size: 0.88rem; cursor: pointer;
  margin-top: 8px; width: 100%;
}
.btn-secundario:hover { border-color: #555; color: #aaa; }

/* ── MODAL EDICIÓN MARCA ── */
#modal-edicion {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 2000; display: flex;
  align-items: center; justify-content: center;
}

#modal-edicion-caja {
  background: #16213e;
  border: 2px solid #4285F4;
  border-radius: 14px; padding: 28px;
  width: 90%; max-width: 460px;
  max-height: 88vh; overflow-y: auto;
}

#modal-edicion-caja h2 { color: #4285F4; margin-bottom: 18px; font-size: 1.3rem; }

#modal-edicion-caja label {
  display: block; margin: 12px 0 5px;
  color: #999; font-size: 0.85rem;
}

#modal-edicion-caja input[type="text"] {
  width: 100%; background: #0f3460;
  border: 1px solid #1a4a8a; border-radius: 7px;
  color: #fff; padding: 9px 11px;
  font-size: 0.92rem; outline: none;
}
#modal-edicion-caja select {
  width: 100%; background: #0f3460;
  border: 1px solid #1a4a8a; border-radius: 7px;
  color: #fff; padding: 9px 11px;
  font-size: 0.92rem; outline: none; cursor: pointer;
}
#modal-edicion-caja select option { background: #16213e; }
#modal-edicion-caja input[type="file"] { margin-top: 4px; color: #888; font-size: 0.85rem; }

/* ── FOTOS EXISTENTES (edición) ── */
#edit-fotos-existentes {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 5px;
}

.foto-existente {
  position: relative;
  width: 65px;
  height: 65px;
}
.foto-existente img {
  width: 100%; height: 100%;
  object-fit: cover; border-radius: 5px;
}
.btn-quitar-foto {
  position: absolute;
  top: -5px; right: -5px;
  background: #e94560; border: none; color: #fff;
  width: 18px; height: 18px; border-radius: 50%;
  font-size: 9px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0; line-height: 1;
}
.btn-quitar-foto:hover { background: #c73652; }

#edit-preview-nuevas { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
#edit-preview-nuevas img { width: 65px; height: 65px; object-fit: cover; border-radius: 5px; }

#edit-progreso-caja {
  margin-top: 12px; background: #0f3460;
  border-radius: 8px; overflow: hidden;
}
#edit-progreso-barra { height: 7px; background: #4285F4; width: 0%; transition: width 0.3s; }
#edit-progreso-texto { display: block; text-align: center; font-size: 0.78rem; color: #888; padding: 5px; }

#btn-guardar-edicion {
  background: #4285F4; color: #fff; border: none;
  padding: 12px; border-radius: 9px;
  font-size: 0.95rem; font-weight: bold;
  cursor: pointer; margin-top: 18px; width: 100%;
}
#btn-guardar-edicion:hover { background: #3367d6; }
#btn-guardar-edicion:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── IMÁGENES INLINE EN EDITOR ── */

/* Wrapper no editable que contiene controles + imagen */
.img-inline {
  display: block;
  margin: 10px 0;
  border-radius: 8px;
  border: 1.5px dashed transparent;
  padding: 2px;
  transition: border-color 0.15s;
  /* Evita que el cursor de texto entre en él */
  user-select: none;
}

/* Resaltar al pasar el ratón (solo dentro del editor) */
.editor-content .img-inline:hover {
  border-color: #4285F4;
}

/* Barra de controles */
.img-inline-controls {
  display: flex;
  align-items: center;
  gap: 3px;
  background: #0a2240;
  border: 1px solid #1a4a8a;
  border-radius: 6px 6px 0 0;
  padding: 4px 7px;
  flex-wrap: nowrap;
  overflow-x: auto;
}

/* Botones de la barra */
.iic-btn {
  background: transparent;
  border: 1px solid transparent;
  color: #bbb;
  min-width: 26px;
  height: 24px;
  border-radius: 4px;
  font-size: 0.88rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  line-height: 1;
}
.iic-btn:hover {
  background: #1a4a8a;
  border-color: #4285F4;
  color: #fff;
}
.iic-btn.activo {
  background: #1a4a8a;
  border-color: #4285F4;
  color: #fff;
}
.iic-btn.iic-del { color: #e94560; }
.iic-btn.iic-del:hover { background: #e94560; border-color: #e94560; color: #fff; }

/* Separador vertical en la barra */
.iic-sep {
  display: inline-block;
  width: 1px;
  height: 16px;
  background: #1a4a8a;
  margin: 0 3px;
  flex-shrink: 0;
}

/* Etiqueta de porcentaje */
.img-size-label {
  font-size: 0.75rem;
  color: #aaa;
  min-width: 34px;
  text-align: center;
  flex-shrink: 0;
}

/* Imagen dentro del wrapper — dentro del editor */
.editor-content .img-inline img {
  border-radius: 0 0 6px 6px;
  display: block;
  max-width: 100%;
}

/* En el panel de visualización: sin controles, imagen limpia */
.descripcion .img-inline {
  border: none;
  padding: 0;
  margin: 10px 0;
}
.descripcion .img-inline-controls { display: none !important; }
.descripcion .img-inline img {
  border-radius: 6px;
  max-width: 100%;
  display: block;
}

/* ── LIGHTBOX ── */
#lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.93);
  z-index: 3000; display: flex;
  align-items: center; justify-content: center;
  cursor: zoom-out;
}
#lightbox img { max-width: 90vw; max-height: 90vh; border-radius: 7px; }
#lightbox-cerrar {
  position: absolute; top: 18px; right: 18px;
  background: #e94560; border: none; color: #fff;
  width: 38px; height: 38px; border-radius: 50%;
  font-size: 17px; cursor: pointer;
}

/* ── OCULTAR ATRIBUCIÓN LEAFLET ── */
.leaflet-control-attribution { display: none !important; }

/* ── PANEL DE CAPAS ── */
#capas-control {
  position: fixed;
  top: 12px; right: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 195px;
}

.capa-fila {
  display: flex;
  align-items: center;
  gap: 4px;
}

.capa-fila .btn-capa { flex: 1; }

.capas-sep {
  border: none;
  border-top: 1px solid #1a3060;
  margin: 5px 0;
}

.btn-capa {
  background-image: url('ui/botongris.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 1px solid #1a3060;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.87rem;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
  text-align: left;
  white-space: nowrap;
}
.btn-capa:hover  { border-color: #4285F4; }
.btn-capa.activo { background-image: url('ui/botonnaranja.png'); border-color: #4285F4; }
.btn-capa.inactivo { opacity: 0.7; }

/* Botón ▾ categorías */
.btn-expandir-cats {
  background: transparent;
  border: 1px solid #1a3060;
  color: #888;
  width: 26px; height: 26px;
  border-radius: 50%;
  font-size: 0.78rem;
  cursor: pointer;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
  padding: 0;
}
.btn-expandir-cats:hover { border-color: #4285F4; color: #4285F4; }

/* Dropdown de categorías */
#categorias-dropdown {
  background: rgba(8, 16, 38, 0.97);
  border: 1px solid #1a3060;
  border-radius: 10px;
  padding: 8px 10px;
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: min(340px, calc(100vh - 320px));
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #4285F4 transparent;
}

#categorias-dropdown::-webkit-scrollbar { width: 4px; }
#categorias-dropdown::-webkit-scrollbar-track {
  background: rgba(15, 52, 96, 0.3);
  border-radius: 10px;
}
#categorias-dropdown::-webkit-scrollbar-thumb {
  background: #4285F4;
  border-radius: 10px;
}
#categorias-dropdown::-webkit-scrollbar-thumb:hover { background: #6aa3f8; }

.cat-fila {
  display: flex;
  align-items: center;
  gap: 7px;
}

.cat-fila input[type="checkbox"] {
  accent-color: #4285F4;
  cursor: pointer;
  width: 13px; height: 13px;
  flex-shrink: 0;
}

.cat-fila label {
  flex: 1;
  font-size: 0.81rem;
  color: #bbb;
  cursor: pointer;
  user-select: none;
}

.btn-isolate {
  background: transparent;
  border: 1px solid #1a3060;
  color: #555;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 0.72rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0; flex-shrink: 0;
  transition: all 0.15s;
  line-height: 1;
}
.btn-isolate:hover { border-color: #4285F4; color: #4285F4; background: rgba(66,133,244,0.12); }
.btn-isolate.activo { border-color: #4285F4; color: #4285F4; background: rgba(66,133,244,0.22); }

/* ── OVERRIDES MODAL NUEVA MARCA ── */
#modal #modal-caja {
  max-width: 736px;
}
#modal .editor-content {
  min-height: 180px;
  max-height: 400px;
}

/* ── OVERRIDES MODAL EDICIÓN MARCA ── */
#modal-edicion #modal-edicion-caja {
  max-width: 736px;
}
#modal-edicion .editor-content {
  min-height: 180px;
  max-height: 400px;
}

/* ── MODAL TAMAÑO DE ICONO ── */
#modal-tamaño {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 2100; display: flex;
  align-items: center; justify-content: center;
}

#modal-tamaño-caja {
  background: #16213e;
  border: 2px solid #a259f7;
  border-radius: 14px;
  padding: 28px 32px;
  width: 90%; max-width: 360px;
  display: flex; flex-direction: column; gap: 18px;
}

#modal-tamaño-caja h2 {
  color: #a259f7;
  font-size: 1.2rem;
  margin: 0;
}

.tamaño-slider-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

#tamaño-slider {
  flex: 1;
  accent-color: #a259f7;
  cursor: pointer;
  height: 6px;
}

#tamaño-valor {
  font-size: 1.1rem;
  font-weight: bold;
  color: #a259f7;
  min-width: 38px;
  text-align: right;
}

.tamaño-hints {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #555;
  margin-top: -10px;
}

#btn-guardar-tamaño {
  background: #a259f7; color: #fff; border: none;
  padding: 11px; border-radius: 9px;
  font-size: 0.95rem; font-weight: bold;
  cursor: pointer; width: 100%;
}
#btn-guardar-tamaño:hover { background: #8b3ee8; }
#btn-guardar-tamaño:disabled { opacity: 0.5; cursor: not-allowed; }

/* ══════════════════════════════
   ICONOS DE SUBCATEGORÍAS EN EL PANEL
══════════════════════════════ */
#panel-subcat-icons {
  position: absolute;
  top: 13px;
  right: 54px;
  display: flex;
  align-items: center;
  gap: -6px;
  z-index: 10;
  flex-direction: row-reverse; /* Los más recientes a la derecha */
}

.panel-subcat-icon {
  width: 56px;
  height: 56px;
  object-fit: contain;
  opacity: 0.88;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.5));
  transition: opacity 0.15s, transform 0.15s;
  margin-top: -10px;
}
.panel-subcat-icon:hover {
  opacity: 1;
  transform: scale(1.15);
}

/* ══════════════════════════════
   FRANJAS DE SUBCATEGORÍAS EN EL PANEL
══════════════════════════════ */
.subcat-franja {
  border-top: 1px solid #0f3460;
  margin-top: 0;
  margin-bottom: 0;
  overflow: hidden;
}

.subcat-franja-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 3px 4px 5px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s;
  user-select: none;
}
.subcat-franja-header:hover {
  background: rgba(66,133,244,0.08);
}

.subcat-franja-icono {
  width: 30px;
  height: 30px;
  object-fit: contain;
  flex-shrink: 0;
  margin-left: -1px;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.4));
}

.subcat-franja-titulo {
  flex: 1;
  color: #e8e8e8;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: 0;
}

.subcat-franja-titulo strong {
  font-weight: 600;
}

.subcat-franja-cat {
  font-size: 0.76rem;
  color: #4285F4;
  white-space: nowrap;
  flex-shrink: 0;
}
.subcat-franja-cat span {
  font-weight: 400;
}

.btn-subcat-toggle {
  background: transparent;
  border: none;
  color: #4285F4;
  font-size: 0.8rem;
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: background 0.15s;
  pointer-events: none; /* El click lo gestiona el header */
}

.subcat-franja-cuerpo {
  padding: 4px 8px 0 0;
  animation: subcatAbrir 0.18s ease;
}

@keyframes subcatAbrir {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.subcat-btns-accion {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.btn-editar-subcat {
  background: transparent;
  border: 1px solid #4285F4;
  color: #4285F4;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-editar-subcat:hover { background: #4285F4; color: #fff; }

.btn-borrar-subcat-panel {
  background: transparent;
  border: 1px solid #e94560;
  color: #e94560;
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.btn-borrar-subcat-panel:hover { background: #e94560; color: #fff; }

/* ══════════════════════════════
   FORMULARIO DE SUBCATEGORÍA (en modales crear/editar)
══════════════════════════════ */
.btn-añadir-subcat {
  width: 100%;
  background: transparent;
  border: 1px dashed #4285F4;
  color: #4285F4;
  padding: 9px;
  border-radius: 9px;
  font-size: 0.88rem;
  cursor: pointer;
  margin-top: 14px;
  transition: background 0.15s, color 0.15s;
}
.btn-añadir-subcat:hover { background: rgba(66,133,244,0.12); }

.subcat-form {
  background: rgba(15,52,96,0.35);
  border: 1px solid #1a3060;
  border-radius: 10px;
  padding: 14px;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.subcat-form-cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.subcat-form-label {
  font-size: 0.82rem;
  font-weight: bold;
  color: #4285F4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.btn-borrar-subcat-form {
  background: transparent;
  border: 1px solid #e94560;
  color: #e94560;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.76rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-borrar-subcat-form:hover { background: #e94560; color: #fff; }

.subcat-lbl {
  display: block;
  margin: 10px 0 4px;
  color: #888;
  font-size: 0.82rem;
}

.subcat-form .subcat-input-titulo {
  width: 100%;
  background: #0f3460;
  border: 1px solid #1a4a8a;
  border-radius: 7px;
  color: #fff;
  padding: 8px 10px;
  font-size: 0.9rem;
  outline: none;
}

.subcat-form .subcat-input-categoria {
  width: 100%;
  background: #0f3460;
  border: 1px solid #1a4a8a;
  border-radius: 7px;
  color: #fff;
  padding: 8px 10px;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}
.subcat-form .subcat-input-categoria option { background: #16213e; }

.subcat-form .editor-content {
  min-height: 70px;
  max-height: 180px;
}

.subcat-form input[type="file"] {
  color: #888;
  font-size: 0.82rem;
  margin-top: 4px;
}

.subcat-preview-fotos {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}
.subcat-preview-fotos img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: 5px;
}

.subcat-fotos-exist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

/* Slider tamaño icono subcategoría */
.subcat-tamaño-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
}
.subcat-tamaño-slider {
  flex: 1;
  accent-color: #a259f7;
  cursor: pointer;
  height: 5px;
}
.subcat-tamaño-valor {
  font-size: 0.88rem;
  font-weight: bold;
  color: #a259f7;
  min-width: 34px;
  text-align: right;
}

/* Botones de orden arriba/abajo */
.subcat-orden-btns {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  justify-content: flex-end;
}
.btn-subcat-orden {
  background: transparent;
  border: 1px solid #4285F4;
  color: #4285F4;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.btn-subcat-orden:hover { background: #4285F4; color: #fff; }

.subcat-progreso-caja {
  margin-top: 8px;
  background: #0f3460;
  border-radius: 6px;
  overflow: hidden;
}
.subcat-progreso-barra {
  height: 5px;
  background: #4285F4;
  width: 0%;
  transition: width 0.3s;
}
.subcat-progreso-texto {
  display: block;
  text-align: center;
  font-size: 0.75rem;
  color: #888;
  padding: 4px;
}

/* ══════════════════════════════
   MODAL EDICIÓN DE SUBCATEGORÍA
══════════════════════════════ */
#modal-subcat-edit {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.72);
  z-index: 2200;
  display: flex;
  align-items: center;
  justify-content: center;
}
#modal-subcat-edit.oculto { display: none !important; }

#modal-subcat-edit-caja {
  background: #16213e;
  border: 2px solid #4285F4;
  border-radius: 14px;
  padding: 28px;
  width: 90%;
  max-width: 540px;
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
}

#modal-subcat-edit-caja h2 {
  color: #4285F4;
  margin-bottom: 10px;
  font-size: 1.2rem;
}

#modal-subcat-edit-caja .subcat-form {
  background: transparent;
  border: none;
  padding: 0;
  margin-top: 0;
}

#btn-guardar-subcat-edit {
  background: #4285F4;
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 9px;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  margin-top: 18px;
  width: 100%;
}
#btn-guardar-subcat-edit:hover { background: #3367d6; }
#btn-guardar-subcat-edit:disabled { opacity: 0.5; cursor: not-allowed; }

/* ══════════════════════════════
   TOOLBAR — FLEX WRAP + NUEVOS BOTONES
══════════════════════════════ */
.editor-toolbar {
  flex-wrap: wrap;
}

/* Botón color de texto */
.btn-color-texto,
.btn-color-fondo {
  width: 30px !important;
  height: 26px !important;
  padding: 3px !important;
}

.color-preview-texto {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: #ffffff;
  border: 1.5px solid rgba(255,255,255,0.25);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.4);
}

.color-preview-fondo {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 4px;
  background: transparent;
  border: 1.5px dashed #666;
  position: relative;
}

/* Símbolo </> en botón código */
.ico-code {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 0.75rem;
  letter-spacing: -0.04em;
  color: inherit;
}

/* ══════════════════════════════
   COLOR PICKER POPUP
══════════════════════════════ */
.color-picker-popup {
  position: fixed;
  background: #16213e;
  border: 1px solid #1a4a8a;
  border-radius: 10px;
  padding: 8px;
  z-index: 9999;
  box-shadow: 0 6px 28px rgba(0,0,0,0.7);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  width: 186px;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.1s, border-color 0.1s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.color-swatch:hover {
  transform: scale(1.25);
  border-color: #fff;
  z-index: 1;
}

.color-custom-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px solid #1a4a8a;
}
.color-custom-row input[type="color"] {
  width: 28px;
  height: 24px;
  border: 1px solid #1a4a8a;
  border-radius: 4px;
  cursor: pointer;
  padding: 1px;
  background: #0f3460;
  flex-shrink: 0;
}
.color-custom-row span {
  font-size: 0.76rem;
  color: #888;
}

/* ══════════════════════════════
   CÓDIGO INLINE Y BLOQUE
══════════════════════════════ */
.codigo-menu-popup {
  position: fixed;
  background: #16213e;
  border: 1px solid #1a4a8a;
  border-radius: 9px;
  padding: 5px;
  z-index: 9999;
  box-shadow: 0 6px 24px rgba(0,0,0,0.65);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 195px;
}

.codigo-menu-popup button {
  width: 100%;
  background: transparent;
  border: none;
  color: #ccc;
  padding: 8px 12px;
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.12s, color 0.12s;
}
.codigo-menu-popup button:hover {
  background: #1a4a8a;
  color: #fff;
}

/* Código inline en editor y panel */
.inline-code {
  font-family: 'Consolas', 'Courier New', monospace;
  background: rgba(114, 137, 218, 0.15);
  border: 1px solid rgba(114, 137, 218, 0.3);
  border-radius: 3px;
  padding: 1px 5px;
  color: #a8b4e8;
  font-size: 0.88em;
  white-space: nowrap;
}

/* Bloque de código */
.block-code-wrap {
  position: relative;
  margin: 8px 0;
  border-radius: 6px;
  overflow: visible;
}

.block-code-del {
  position: absolute;
  top: 6px;
  right: 8px;
  background: rgba(233,69,96,0.18);
  border: 1px solid #e94560;
  color: #e94560;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background 0.15s;
  z-index: 1;
}
.block-code-del:hover { background: #e94560; color: #fff; }

.block-code {
  display: block;
  font-family: 'Consolas', 'Courier New', monospace;
  background: #1e1f2e;
  border: 1px solid #2a3060;
  border-radius: 6px;
  padding: 10px 40px 10px 14px;
  margin: 0;
  color: #abb2bf;
  font-size: 0.88em;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.55;
  outline: none;
  min-height: 40px;
}
.block-code:focus {
  border-color: #4285F4;
  box-shadow: 0 0 0 2px rgba(66,133,244,0.15);
}

/* En panel (sin botón delete) */
.descripcion .block-code-del { display: none !important; }
.descripcion .block-code { padding-right: 14px; }

/* ══════════════════════════════
   TABLAS EN EL EDITOR
══════════════════════════════ */
.editor-table-wrap {
  margin: 8px 0;
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #1a4a8a;
}

/* Barra de controles de tabla */
.table-controls {
  display: flex;
  gap: 4px;
  padding: 5px 7px;
  background: #0a2240;
  border-bottom: 1px solid #1a4a8a;
  border-radius: 7px 7px 0 0;
  flex-wrap: wrap;
}

.table-ctrl-btn {
  background: transparent;
  border: 1px solid #1a4a8a;
  color: #bbb;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  line-height: 1.4;
}
.table-ctrl-btn:hover { background: #1a4a8a; color: #fff; }
.table-ctrl-btn.danger { border-color: #7f3040; color: #e94560; }
.table-ctrl-btn.danger:hover { background: #e94560; border-color: #e94560; color: #fff; }

/* La tabla en sí */
.editor-table {
  border-collapse: collapse;
  min-width: 200px;
  width: 100%;
}

.editor-table td,
.editor-table th {
  border: 1px solid #1a4a8a;
  padding: 6px 10px;
  min-width: 80px;
  min-height: 28px;
  background: rgba(15, 52, 96, 0.4);
  color: #ddd;
  font-size: 0.9rem;
  vertical-align: top;
  outline: none;
  white-space: pre-wrap;
  word-break: break-word;
}

.editor-table td:focus,
.editor-table th:focus {
  background: rgba(66, 133, 244, 0.12);
  border-color: #4285F4;
  box-shadow: inset 0 0 0 1px #4285F4;
}

/* En el panel de visualización: sin barra de controles */
.descripcion .table-controls { display: none !important; }
.descripcion .editor-table-wrap { border-color: #1a3060; }

/* ══════════════════════════════
   TOOLTIPS LEÍDO / NO LEÍDO
══════════════════════════════ */

/* Estado leído: texto blanco flotante, sin fondo */
.leaflet-tooltip.tooltip-leido {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  color: #ffffff !important;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-shadow:
    0 1px 4px rgba(0,0,0,0.95),
    0 0 8px rgba(0,0,0,0.8),
    0 0 2px rgba(0,0,0,1);
  padding: 2px 5px;
  white-space: nowrap;
}
.leaflet-tooltip.tooltip-leido::before {
  display: none !important;
}

/* Estado no leído: píldora amarilla llamativa */
.leaflet-tooltip.tooltip-no-leido {
  background: rgba(255, 224, 50, 0.93) !important;
  border: 1px solid rgba(200, 160, 0, 0.55) !important;
  box-shadow: 0 2px 10px rgba(0,0,0,0.55), 0 0 0 2px rgba(255,200,0,0.18) !important;
  color: #2a1f00 !important;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  border-radius: 20px;
  padding: 2px 8px;
  white-space: nowrap;
  animation: tooltipPulse 2.4s ease-in-out infinite;
}
.leaflet-tooltip.tooltip-no-leido::before {
  display: none !important;
}

@keyframes tooltipPulse {
  0%,  100% { box-shadow: 0 2px 10px rgba(0,0,0,0.55), 0 0 0 2px rgba(255,200,0,0.18) !important; }
  50%       { box-shadow: 0 2px 14px rgba(0,0,0,0.6),  0 0 0 5px rgba(255,200,0,0.30) !important; }
}

