/* =====================================================================
   editor.css — Pantalla del cuaderno abierto.

   La hoja ocupa toda la pantalla. Encima flotan, sin estorbar:
     · la barra de herramientas (se arrastra a cualquier borde)
     · el panel de opciones de la herramienta (color y grosor)
     · el indicador de página, en una esquina
   Mientras se escribe, todo eso se atenúa.
   ===================================================================== */

.pantalla-editor {
  position: relative;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  /* El relleno no mueve nada (los hijos son absolutos): solo sirve para
     que barra.js lea los bordes seguros de la pantalla. */
  padding: var(--seguro-arriba) var(--seguro-der) var(--seguro-abajo) var(--seguro-izq);
}

/* --- Lienzo ----------------------------------------------------------- */

.lienzo {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #e4dfd3;
  cursor: crosshair;
  /* Todos los gestos los maneja la app, no el navegador */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Los dos lienzos superpuestos: base (hoja) y vivo (trazo en curso) */
.lienzo-capa {
  position: absolute;
  left: 0;
  top: 0;
  display: block;
  transform-origin: 0 0;
}

.lienzo-vivo { pointer-events: none; }

/* --- Barra flotante ---------------------------------------------------- */

.barra {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--borde);
  border-radius: 16px;
  background: var(--superficie);
  box-shadow: var(--sombra);
  transition: transform .16s ease-out, opacity .15s;
  touch-action: none;
}
.barra[data-sentido="vertical"] { flex-direction: column; }
.barra-arrastrando { transition: none; box-shadow: 0 10px 30px rgba(40, 35, 25, .28); }

.barra-agarre {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 26px;
  border-radius: 10px;
  color: var(--tinta-suave);
  opacity: .55;
  cursor: grab;
  touch-action: none;
}
.barra-agarre:active { cursor: grabbing; background: rgba(0, 0, 0, .06); }
.barra-agarre svg { width: 20px; height: 20px; }
.barra[data-sentido="vertical"] .barra-agarre .icono { transform: rotate(90deg); }
.barra[data-sentido="horizontal"] .barra-agarre { width: 26px; height: 42px; }

.barra-boton {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--tinta-suave);
}
.barra-boton:active { background: rgba(0, 0, 0, .08); }
.barra-boton:disabled { opacity: .28; cursor: default; }
.barra-boton svg { width: 22px; height: 22px; }

.barra-activo {
  background: color-mix(in srgb, var(--acento) 14%, transparent);
  color: var(--acento-fuerte);
}

/* Rayita con el color de cada herramienta */
.barra-tinta {
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 4px;
  height: 3px;
  border-radius: 2px;
}

/* Botón de opciones: un punto con el color y el grosor actuales */
.barra-muestra {
  display: block;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .18);
}
.barra-muestra-aro {
  background: transparent;
  box-shadow: none;
  border: 2px solid var(--tinta-suave);
}

.barra-separador {
  flex: none;
  background: var(--borde);
}
.barra[data-sentido="vertical"] .barra-separador { width: 24px; height: 1px; margin: 3px 0; }
.barra[data-sentido="horizontal"] .barra-separador { width: 1px; height: 24px; margin: 0 3px; }

/* --- Panel de opciones (color y grosor) -------------------------------- */

.opciones {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 11;
  width: 264px;
  max-width: calc(100% - 20px);
  max-height: calc(100% - 20px);
  overflow-y: auto;
  padding: 14px;
  border: 1px solid var(--borde);
  border-radius: 16px;
  background: var(--superficie);
  box-shadow: var(--sombra);
}

.opciones-contenido { display: flex; flex-direction: column; gap: 10px; }
.opciones-titulo { font-weight: 700; }
.opciones-rotulo {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--tinta-suave);
}

.grosores { display: flex; gap: 4px; }
.grosor {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  height: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
}
.grosor:active { background: rgba(0, 0, 0, .06); }
.grosor-activo { border-color: var(--acento); background: color-mix(in srgb, var(--acento) 10%, transparent); }
.grosor-punto { display: block; border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); }
.grosor-aro { display: block; border-radius: 50%; border: 2px solid var(--tinta-suave); }

.muestras { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.muestra {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  max-width: 42px;
  padding: 0;
  border: 3px solid var(--superficie);
  border-radius: 50%;
  background: var(--color, transparent);
  box-shadow: 0 0 0 1px var(--borde);
  justify-self: center;
}
.muestra-activa { box-shadow: 0 0 0 3px var(--tinta); }

.muestra-agregar {
  border: 2px dashed var(--borde);
  box-shadow: none;
  color: var(--tinta-suave);
  overflow: hidden;
  cursor: pointer;
}
.muestra-agregar svg { width: 18px; height: 18px; }
/* El selector de color del sistema, invisible pero cubriendo todo el botón */
.muestra-agregar input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.opciones-quitar {
  min-height: 40px;
  padding: 0 8px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: .85rem;
  color: var(--peligro);
}
.opciones-quitar:active { background: rgba(0, 0, 0, .06); }

.opciones .segmento span { min-height: 38px; font-size: .85rem; text-align: center; }

/* --- Indicador de página ----------------------------------------------- */

.pildora {
  position: absolute;
  right: calc(10px + var(--seguro-der));
  bottom: calc(10px + var(--seguro-abajo));
  z-index: 9;
  display: flex;
  align-items: center;
  border: 1px solid var(--borde);
  border-radius: 99px;
  background: color-mix(in srgb, var(--superficie) 88%, transparent);
  box-shadow: 0 1px 4px rgba(40, 35, 25, .12);
  transition: opacity .15s;
}
/* Si la barra está en el borde de abajo, el indicador sube a la esquina de arriba */
.pantalla-editor[data-barra="abajo"] .pildora {
  bottom: auto;
  top: calc(10px + var(--seguro-arriba));
}

.pildora-texto {
  min-width: 46px;
  padding: 0 2px;
  font-size: .85rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--tinta-suave);
}

.pildora-boton {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--tinta-suave);
}
.pildora-boton:active { background: rgba(0, 0, 0, .08); }
.pildora-boton:disabled { opacity: .28; cursor: default; }
.pildora-boton svg { width: 20px; height: 20px; }

/* --- Mientras se escribe ----------------------------------------------- */
/* La barra y el indicador se atenúan y dejan pasar el lápiz. */

.escribiendo .barra,
.escribiendo .pildora {
  opacity: .22;
  pointer-events: none;
}

/* --- Lazo: botón de opciones sin color --------------------------------- */

.barra-muestra-lazo {
  width: 14px !important;
  height: 14px !important;
  background: transparent !important;
  box-shadow: none;
  border: 2px dashed var(--tinta-suave);
}
.opciones-ayuda { font-size: .9rem; line-height: 1.45; color: var(--tinta-suave); }

/* --- Marco de selección ------------------------------------------------- */

.sel-caja {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 8;
  border: 1.5px dashed var(--acento);
  border-radius: 4px;
  background: color-mix(in srgb, var(--acento) 5%, transparent);
  cursor: move;
  touch-action: none;
}

/* Esquinas para agrandar: el área táctil es más grande que el punto visible */
.sel-tirador {
  position: absolute;
  width: 36px;
  height: 36px;
  touch-action: none;
}
.sel-tirador::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid var(--acento);
  border-radius: 50%;
  background: var(--superficie);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.sel-tirador[data-esquina="no"] { left: -18px; top: -18px; cursor: nwse-resize; }
.sel-tirador[data-esquina="ne"] { right: -18px; top: -18px; cursor: nesw-resize; }
.sel-tirador[data-esquina="so"] { left: -18px; bottom: -18px; cursor: nesw-resize; }
.sel-tirador[data-esquina="se"] { right: -18px; bottom: -18px; cursor: nwse-resize; }

/* Barrita de acciones de la selección */
.sel-barra {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--borde);
  border-radius: 14px;
  background: var(--superficie);
  box-shadow: var(--sombra);
  max-width: calc(100% - 16px);
  overflow-x: auto;
}
.sel-boton {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  flex: none;
  min-width: 52px;
  height: 48px;
  padding: 0 6px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font-size: .7rem;
  color: var(--tinta-suave);
}
.sel-boton:active { background: rgba(0, 0, 0, .07); }
.sel-boton svg { width: 20px; height: 20px; }
.sel-peligro { color: var(--peligro); }
.sel-color {
  flex: none;
  width: 34px;
  height: 34px;
  margin: 0 2px;
  padding: 0;
  border: 3px solid var(--superficie);
  border-radius: 50%;
  background: var(--color);
  box-shadow: 0 0 0 1px var(--borde);
}

/* Mientras se escribe, la selección no estorba */
.escribiendo .sel-barra { opacity: .2; pointer-events: none; }

/* --- Ventana de texto ---------------------------------------------------- */

.campo-texto {
  min-height: 140px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.4;
}

/* --- Ventana de recorte -------------------------------------------------- */

.capa-recorte { padding: calc(10px + var(--seguro-arriba)) calc(10px + var(--seguro-der))
                         calc(10px + var(--seguro-abajo)) calc(10px + var(--seguro-izq)); }

.recorte-ventana {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1100px;
  height: 100%;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--superficie);
  box-shadow: var(--sombra);
}
.recorte-cabecera .dialogo-titulo { margin-bottom: 2px; }

.recorte-area {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  border-radius: 12px;
  background: #2b2d31;
  overflow: hidden;
}

.recorte-lienzo { position: relative; flex: none; }
.recorte-imagen {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-user-select: none;
  user-select: none;
}

/* El recuadro oscurece todo lo que queda fuera de él */
.recorte-caja {
  position: absolute;
  border: 2px solid #fff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55);
  cursor: move;
  touch-action: none;
}
.recorte-tercios {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to right, transparent calc(33.33% - .5px), rgba(255, 255, 255, .45) calc(33.33% - .5px),
      rgba(255, 255, 255, .45) calc(33.33% + .5px), transparent calc(33.33% + .5px),
      transparent calc(66.66% - .5px), rgba(255, 255, 255, .45) calc(66.66% - .5px),
      rgba(255, 255, 255, .45) calc(66.66% + .5px), transparent calc(66.66% + .5px)),
    linear-gradient(to bottom, transparent calc(33.33% - .5px), rgba(255, 255, 255, .45) calc(33.33% - .5px),
      rgba(255, 255, 255, .45) calc(33.33% + .5px), transparent calc(33.33% + .5px),
      transparent calc(66.66% - .5px), rgba(255, 255, 255, .45) calc(66.66% - .5px),
      rgba(255, 255, 255, .45) calc(66.66% + .5px), transparent calc(66.66% + .5px));
}

/* Tiradores: área táctil grande, marca visible pequeña */
.recorte-tirador { position: absolute; width: 40px; height: 40px; touch-action: none; z-index: 1; }
.recorte-tirador::after {
  content: '';
  position: absolute;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 0 3px rgba(0, 0, 0, .5);
}
.recorte-tirador[data-lado="n"], .recorte-tirador[data-lado="s"] { left: calc(50% - 20px); cursor: ns-resize; }
.recorte-tirador[data-lado="e"], .recorte-tirador[data-lado="o"] { top: calc(50% - 20px); cursor: ew-resize; }
.recorte-tirador[data-lado="n"] { top: -20px; }
.recorte-tirador[data-lado="s"] { bottom: -20px; }
.recorte-tirador[data-lado="e"] { right: -20px; }
.recorte-tirador[data-lado="o"] { left: -20px; }
.recorte-tirador[data-lado="n"]::after, .recorte-tirador[data-lado="s"]::after { left: 10px; top: 17px; width: 20px; height: 6px; }
.recorte-tirador[data-lado="e"]::after, .recorte-tirador[data-lado="o"]::after { left: 17px; top: 10px; width: 6px; height: 20px; }
.recorte-tirador[data-lado="no"] { left: -20px; top: -20px; cursor: nwse-resize; }
.recorte-tirador[data-lado="ne"] { right: -20px; top: -20px; cursor: nesw-resize; }
.recorte-tirador[data-lado="so"] { left: -20px; bottom: -20px; cursor: nesw-resize; }
.recorte-tirador[data-lado="se"] { right: -20px; bottom: -20px; cursor: nwse-resize; }
.recorte-tirador[data-lado="no"]::after, .recorte-tirador[data-lado="ne"]::after,
.recorte-tirador[data-lado="so"]::after, .recorte-tirador[data-lado="se"]::after {
  left: 13px; top: 13px; width: 14px; height: 14px; border-radius: 50%;
}

/* --- Aviso del modo conector -------------------------------------------- */

.modo-aviso {
  position: absolute;
  left: 50%;
  top: calc(12px + var(--seguro-arriba));
  z-index: 12;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 24px);
  padding: 6px 6px 6px 16px;
  border: 1px solid var(--borde);
  border-radius: 14px;
  background: var(--superficie);
  box-shadow: var(--sombra);
  font-size: .9rem;
  transform: translateX(-50%);
}
.modo-aviso .boton { min-height: 40px; padding: 0 16px; }
.escribiendo .modo-aviso { opacity: .3; }

/* --- Marco de selección: estirar por los lados y girar ------------------- */

/* Lados: una barrita en el medio de cada lado estira solo en esa dirección */
.sel-lado {
  position: absolute;
  touch-action: none;
}
.sel-lado::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  border: 2px solid var(--acento);
  border-radius: 4px;
  background: var(--superficie);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.sel-lado[data-lado="n"], .sel-lado[data-lado="s"] { left: calc(50% - 22px); width: 44px; height: 32px; cursor: ns-resize; }
.sel-lado[data-lado="e"], .sel-lado[data-lado="o"] { top: calc(50% - 22px); width: 32px; height: 44px; cursor: ew-resize; }
.sel-lado[data-lado="n"] { top: -16px; }
.sel-lado[data-lado="s"] { bottom: -16px; }
.sel-lado[data-lado="e"] { right: -16px; }
.sel-lado[data-lado="o"] { left: -16px; }
.sel-lado[data-lado="n"]::after, .sel-lado[data-lado="s"]::after { width: 20px; height: 8px; margin: -4px 0 0 -10px; }
.sel-lado[data-lado="e"]::after, .sel-lado[data-lado="o"]::after { width: 8px; height: 20px; margin: -10px 0 0 -4px; }
.sel-chica .sel-lado { display: none; }

/* Círculo para girar, arriba al centro, unido al marco por una línea */
.sel-giro {
  position: absolute;
  left: calc(50% - 18px);
  top: -54px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 2px solid var(--acento);
  border-radius: 50%;
  background: var(--superficie);
  color: var(--acento-fuerte);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
  touch-action: none;
  cursor: grab;
}
.sel-giro svg { width: 18px; height: 18px; }
.sel-giro::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 34px;
  width: 0;
  height: 18px;
  border-left: 1.5px dashed var(--acento);
}

/* Ángulo mientras se gira */
.sel-angulo {
  position: absolute;
  left: calc(50% - 30px);
  top: calc(50% - 16px);
  width: 60px;
  padding: 5px 0;
  border-radius: 10px;
  background: var(--tinta);
  color: var(--superficie);
  font-size: .85rem;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
}

/* --- Edición de vértices ------------------------------------------------ */

.vert-punto {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 9;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  touch-action: none;
  cursor: move;
}
.vert-punto::after {
  content: '';
  position: absolute;
  left: 11px;
  top: 11px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--superficie);
  border-radius: 50%;
  background: var(--acento);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.vert-barra {
  position: absolute;
  left: 50%;
  top: calc(12px + var(--seguro-arriba));
  z-index: 11;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 14px;
  border: 1px solid var(--borde);
  border-radius: 14px;
  background: var(--superficie);
  box-shadow: var(--sombra);
  transform: translateX(-50%);
  font-size: .9rem;
  color: var(--tinta-suave);
  white-space: nowrap;
}

/* Muestra «sin relleno» (recuadro): blanca con una raya diagonal */
.muestra-ninguno {
  background:
    linear-gradient(135deg, transparent calc(50% - 1px), #dc2626 calc(50% - 1px), #dc2626 calc(50% + 1px), transparent calc(50% + 1px)),
    var(--superficie) !important;
}

/* ---------------------------------------------------------------------
   Elegir páginas de un PDF (js/ui/paginas-pdf.js)
   --------------------------------------------------------------------- */
.dialogo-pdfsel { max-width: 720px; }
.pdfsel-barra { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pdfsel-contador { font-weight: 600; transition: color .2s; }
.pdfsel-contador.pdfsel-falta { color: var(--peligro); }
.pdfsel-atajo { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.pdfsel-rejilla {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 12px;
  max-height: min(46vh, 430px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px;
  border-radius: 12px;
  background: var(--presionado, rgba(0, 0, 0, .04));
}
.pdfsel-pagina {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px; border: 0; border-radius: 10px; background: none; color: inherit;
  cursor: pointer; font: inherit;
}
.pdfsel-hoja {
  position: relative; display: block; width: 100%;
  border-radius: 4px; outline: 2px solid var(--borde); outline-offset: 0;
  background: #fff; overflow: hidden;
  transition: outline-color .12s, transform .12s;
}
.pdfsel-lienzo { display: block; width: 100%; height: auto; opacity: .25; transition: opacity .2s; }
.pdfsel-lienzo.lista { opacity: 1; }
.pdfsel-marca {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; font-size: 14px; font-weight: 700;
  background: rgba(255, 255, 255, .9); color: transparent; border: 2px solid #8a8f94;
}
.pdfsel-pagina.elegida .pdfsel-hoja { outline: 3px solid var(--acento); transform: scale(.97); }
.pdfsel-pagina.elegida .pdfsel-marca { background: var(--acento); border-color: var(--acento); color: #fff; }
.pdfsel-numero { font-size: .85rem; color: var(--tinta-suave); }
.pdfsel-pagina.elegida .pdfsel-numero { color: var(--tinta); font-weight: 700; }
.pdfsel-destinos { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.pdfsel-destino {
  display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px;
  border: 1px solid var(--borde); border-radius: 12px; cursor: pointer;
}
.pdfsel-destino:has(input:checked) { border-color: var(--acento); background: var(--presionado, rgba(0, 0, 0, .04)); }
.pdfsel-destino input { margin-top: 3px; accent-color: var(--acento); }
.pdfsel-destino span { display: flex; flex-direction: column; gap: 2px; }
.pdfsel-destino small { color: var(--tinta-suave); }
[data-tema="oscuro"] .pdfsel-lienzo { filter: none; }

/* ---------------------------------------------------------------------
   Editor de tablas (js/contenido/editor-tabla.js)
   --------------------------------------------------------------------- */
.dialogo-tabla { max-width: min(980px, 100%); }
.tabla-ed-barra { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 14px; align-items: center; }
.tabla-ed-grupo { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tabla-ed-boton { min-height: 38px; padding: 0 12px; border: 1px solid var(--borde); font-size: .92rem; }
.tabla-ed-casilla { margin: 0 4px; }
.tabla-ed-tamano { width: auto; min-height: 38px; padding: 0 10px; }
.tabla-ed-colores { display: flex; gap: 6px; }
.tabla-ed-color { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.tabla-ed-color[aria-pressed="true"] { outline: 2px solid var(--acento); outline-offset: 2px; }
.tabla-ed-area {
  max-height: min(58vh, 560px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--tinta-suave) 8%, transparent);
}
.tabla-ed-rejilla { display: grid; width: max-content; background: #fff; color: var(--tinta-tabla); }
.tabla-ed-esquina { background: var(--superficie); }
.tabla-ed-col, .tabla-ed-fila {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  background: var(--superficie);
  color: var(--tinta-suave);
  user-select: none;
}
.tabla-ed-col.elegida, .tabla-ed-fila.elegida { color: var(--acento); background: color-mix(in srgb, var(--acento) 12%, var(--superficie)); }
.tabla-ed-col.destino { box-shadow: inset 3px 0 0 var(--acento); }
.tabla-ed-fila.destino { box-shadow: inset 0 3px 0 var(--acento); }
.tabla-ed-col.arrastrada, .tabla-ed-fila.arrastrada { background: color-mix(in srgb, var(--acento) 28%, var(--superficie)); }
.tabla-ed-agarre {
  display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%;
  font-size: 15px; line-height: 1; cursor: grab; touch-action: none;
}
.tabla-ed-borde { position: absolute; z-index: 2; touch-action: none; }
.tabla-ed-borde::after { content: ''; position: absolute; background: var(--acento); opacity: 0; transition: opacity .12s; }
.tabla-ed-borde:hover::after, .tabla-ed-borde.activo::after { opacity: .8; }
.tabla-ed-borde-col { top: 0; right: -9px; width: 18px; height: 100%; cursor: col-resize; }
.tabla-ed-borde-col::after { left: 8px; top: 3px; bottom: 3px; width: 3px; border-radius: 2px; }
.tabla-ed-borde-fila { left: 0; bottom: -9px; height: 18px; width: 100%; cursor: row-resize; }
.tabla-ed-borde-fila::after { top: 8px; left: 3px; right: 3px; height: 3px; border-radius: 2px; }
.tabla-ed-celda {
  box-sizing: border-box;
  overflow: hidden;
  padding: var(--pad);
  border-right: 1px solid var(--tinta-tabla);
  border-bottom: 1px solid var(--tinta-tabla);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  font-size: var(--letra);
  line-height: 1.3;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  outline: none;
  cursor: text;
  background: #fff;
  color: var(--tinta-tabla);
}
.tabla-ed-celda.encabezado { font-weight: 700; background: #dfe9f6; }
.tabla-ed-celda:focus { box-shadow: inset 0 0 0 2px var(--acento); }
.tabla-ed-celda.arrastrada { opacity: .55; }
/* Borde de afuera: la primera fila y la primera columna de celdas */
.tabla-ed-celda[data-f="0"] { border-top: 1px solid var(--tinta-tabla); }
.tabla-ed-celda[data-c="0"] { border-left: 1px solid var(--tinta-tabla); }

/* Barra en pantallas bajas o angostas (ver colocar() en barra.js) */
.barra-compacta { gap: 0; padding: 3px; }
.barra-compacta .barra-boton { width: 36px; height: 36px; border-radius: 10px; }
.barra-compacta .barra-boton svg { width: 19px; height: 19px; }
.barra-compacta[data-sentido="vertical"] .barra-separador { margin: 2px 0; }
.barra-compacta[data-sentido="horizontal"] .barra-separador { margin: 0 2px; }
.barra-desplazable { scrollbar-width: none; overscroll-behavior: contain; }
.barra-desplazable::-webkit-scrollbar { display: none; }
.barra-desplazable[data-sentido="vertical"] { overflow-y: auto; touch-action: pan-y; }
.barra-desplazable[data-sentido="horizontal"] { overflow-x: auto; touch-action: pan-x; }
