/* DRB Lámina · Estilo DRB Studio (beige, grafito, Geist, acento terracota).
   Inspirado en ArchiPT, optimizado para móvil primero y pantallas de escritorio. */
:root {
  --fondo: #f3f1ec;
  --panel: #fbfaf7;
  --panel-elevado: #ffffff;
  --texto: #26251f;
  --suave: #6b675d;
  --borde: #ded8cc;
  --borde-fuerte: #bfb8a8;
  --grafito: #2b2a25;
  --acento: #a8481f;
  --acento-suave: #f2e3dc;
  --salida: cubic-bezier(0.23, 1, 0.32, 1);
  --altura-barra: 56px;
  --ancho-nav-pestanas: 64px;
  --ancho-panel: 340px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--fondo);
  color: var(--texto);
  font-family: Geist, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14.5px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--acento);
  outline-offset: 2px;
}

/* ==========================================================================
   1. BARRA SUPERIOR
   ========================================================================== */
.barra-superior {
  height: var(--altura-barra);
  background: var(--panel);
  border-bottom: 1px solid var(--borde);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  position: relative;
  z-index: 20;
}

.superior-izq, .superior-centro, .superior-der {
  display: flex;
  align-items: center;
  gap: 10px;
}

.marca {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--texto);
  text-decoration: none;
  font-weight: 700;
  font-size: 15px;
  min-height: 44px;
}
.marca img { border-radius: 6px; }

.separador {
  color: var(--borde-fuerte);
  user-select: none;
}

.titulo-app {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
}

.etiqueta-estado {
  font-size: 11.5px;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
  background: #ebe6da;
  color: var(--suave);
  white-space: nowrap;
}
.etiqueta-estado.guardado {
  background: #e2edd8;
  color: #2e591b;
}

/* Botones genéricos de cabecera */
.btn-principal, .btn-secundario, .btn-icono, .btn-texto, .btn-formato, .btn-cuenta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--borde-fuerte);
  background: var(--panel);
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  text-decoration: none;
  transition: transform .12s var(--salida), background-color .15s ease, border-color .15s ease;
  user-select: none;
}

.btn-principal {
  background: var(--grafito);
  color: #ffffff;
  border-color: var(--grafito);
}
.btn-principal:hover { background: #3b3a33; border-color: #3b3a33; }
.btn-principal:active { transform: scale(0.97); }

.btn-secundario:hover, .btn-icono:hover, .btn-texto:hover, .btn-cuenta:hover {
  background: var(--panel-elevado);
  border-color: var(--texto);
}
.btn-secundario:active, .btn-icono:active { transform: scale(0.97); }

.btn-icono {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 8px;
}
.btn-icono:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-texto {
  border: none;
  background: transparent;
  padding: 0 8px;
  color: var(--suave);
}
.btn-texto:hover { color: var(--texto); background: #ebe6da; }

.grupo-botones {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #ede9e0;
  padding: 3px;
  border-radius: 10px;
}

.grupo-formato {
  display: flex;
  align-items: center;
  gap: 2px;
  background: #ede9e0;
  padding: 3px;
  border-radius: 10px;
}

.btn-formato {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12.5px;
  border: none;
  background: transparent;
  color: var(--suave);
  border-radius: 7px;
}
.btn-formato.activo {
  background: var(--panel-elevado);
  color: var(--texto);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

.menu-descarga {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-cuenta {
  min-height: 40px;
  padding: 0 12px;
  color: var(--texto);
}

/* ==========================================================================
   2. CONTENEDOR PRINCIPAL (APLICACIÓN)
   ========================================================================== */
.aplicacion {
  height: calc(100vh - var(--altura-barra));
  height: calc(100dvh - var(--altura-barra));
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ==========================================================================
   3. BARRA LATERAL IZQUIERDA (NAVEGACIÓN + PANEL)
   ========================================================================== */
.panel-lateral {
  display: flex;
  height: 100%;
  border-right: 1px solid var(--borde);
  background: var(--panel);
  z-index: 15;
  box-shadow: 4px 0 16px rgba(0,0,0,0.03);
}

/* Selector de pestañas verticales */
.pestanas-nav {
  width: var(--ancho-nav-pestanas);
  flex-shrink: 0;
  background: #ece8df;
  border-right: 1px solid var(--borde);
  display: flex;
  flex-direction: column;
  padding: 10px 4px;
  gap: 6px;
}

.pestana-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-height: 54px;
  padding: 6px 2px;
  border: none;
  background: transparent;
  color: var(--suave);
  border-radius: 8px;
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 600;
  transition: all .15s ease;
}
.pestana-btn:hover {
  color: var(--texto);
  background: rgba(0,0,0,0.04);
}
.pestana-btn.activa {
  background: var(--panel);
  color: var(--texto);
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.pestana-btn.activa svg { stroke: var(--acento); }

/* Panel de contenido de la pestaña seleccionada */
.panel-contenido {
  width: var(--ancho-panel);
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 18px 16px;
  background: var(--panel);
}

.cabecera-panel {
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--borde);
}
.cabecera-panel h2 {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.descripcion-panel {
  margin: 0;
  color: var(--suave);
  font-size: 12.5px;
}

/* ==========================================================================
   4. SECCIÓN MATERIAL
   ========================================================================== */
.caja-subida {
  border: 2px dashed var(--borde-fuerte);
  background: #f7f5ef;
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.caja-subida:hover, .caja-subida.drag-over {
  border-color: var(--acento);
  background: #fefcf9;
}
.caja-subida strong { font-size: 14px; }
.caja-subida span { font-size: 12px; color: var(--suave); }
.icono-subida { color: var(--acento); margin-bottom: 2px; }
.btn-subir { margin-top: 6px; width: 100%; }
.nota-segura { font-size: 11px; color: var(--suave); margin-top: 4px; }

.bloque-lista-imagenes {
  margin-top: 16px;
}
.fila-titulo-conteo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.fila-titulo-conteo h3 { margin: 0; font-size: 14px; }
.badge {
  background: #ede9e0;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--suave);
}

.lista-miniaturas-material {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}
.item-material {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 8px;
  border: 1px solid var(--borde);
  background: var(--panel-elevado);
  cursor: pointer;
  transition: border-color .15s ease;
}
.item-material:hover { border-color: var(--texto); }
.item-material.seleccionado {
  border-color: var(--acento);
  background: var(--acento-suave);
}
.item-material img {
  width: 52px;
  height: 38px;
  object-fit: cover;
  border-radius: 4px;
  background: #e6e1d6;
}
.info-material {
  flex: 1;
  min-width: 0;
}
.info-material strong {
  display: block;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.info-material span {
  font-size: 11px;
  color: var(--suave);
}

.banner-visor {
  margin-top: 20px;
  padding: 12px;
  background: #ebe6da;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.banner-visor strong { font-size: 13px; }
.banner-visor p { margin: 0; font-size: 12px; color: var(--suave); }
.banner-visor a { align-self: flex-start; margin-top: 4px; }

/* ==========================================================================
   5. SECCIÓN DISEÑO
   ========================================================================== */
.campo-grupo {
  margin-bottom: 16px;
}
.etiqueta-campo {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--suave);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: 8px;
}

.rejilla-estilos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tarjeta-estilo-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--borde);
  background: var(--panel-elevado);
  cursor: pointer;
  text-align: left;
  transition: all .15s ease;
}
.tarjeta-estilo-btn:hover { border-color: var(--texto); }
.tarjeta-estilo-btn.activo {
  border-color: var(--acento);
  box-shadow: 0 0 0 2px var(--acento);
}
.muestra-paleta {
  display: flex;
  gap: 4px;
  width: 100%;
  height: 14px;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 6px;
  border: 1px solid rgba(0,0,0,0.1);
}
.color-barra { flex: 1; height: 100%; }
.tarjeta-estilo-btn strong { font-size: 13px; font-weight: 600; }
.tarjeta-estilo-btn span { font-size: 11px; color: var(--suave); }

.selector-dos-opciones {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.opcion-caja {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--borde);
  background: var(--panel-elevado);
  cursor: pointer;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.opcion-caja:hover { border-color: var(--texto); }
.opcion-caja.activa {
  border-color: var(--acento);
  background: #fff;
  box-shadow: 0 0 0 2px var(--acento);
}
.opcion-caja strong { font-size: 13px; }
.opcion-caja span { font-size: 11px; color: var(--suave); }

.muestra-color-fondo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--borde);
  border-radius: 8px;
  background: var(--panel-elevado);
}
.circulo-tono {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.15);
}
.codigo-tono { font-family: monospace; font-size: 12.5px; }
.nombre-estilo-actual { color: var(--suave); margin-left: auto; font-size: 12px; }

/* ==========================================================================
   6. SECCIÓN TEXTO
   ========================================================================== */
.formulario-textos label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--suave);
  margin-bottom: 4px;
}
.formulario-textos input[type="text"],
.formulario-textos textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--borde-fuerte);
  border-radius: 6px;
  background: var(--panel-elevado);
  line-height: 1.4;
}
.formulario-textos input[type="text"]:focus,
.formulario-textos textarea:focus {
  border-color: var(--acento);
}
.formulario-textos textarea { resize: vertical; }

.mb-4 { margin-bottom: 6px; }
.divisor-suave {
  border: 0;
  height: 1px;
  background: var(--borde);
  margin: 18px 0;
}
.fila-dos-campos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.lista-pies-edicion {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.item-pie-edicion {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ==========================================================================
   7. SECCIÓN IA
   ========================================================================== */
.bloque-ia {
  background: #f7f4ec;
  border: 1px solid var(--borde);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 14px;
}
.bloque-ia h3 { margin: 0 0 10px; font-size: 14.5px; font-weight: 700; }
.bloque-ia label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--suave);
  margin-bottom: 4px;
}
.bloque-ia input, .bloque-ia textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--borde-fuerte);
  border-radius: 6px;
  background: var(--panel-elevado);
  margin-bottom: 10px;
}
.w-100 { width: 100%; }
.nota-cuenta {
  display: block;
  text-align: center;
  font-size: 11px;
  color: var(--suave);
  margin-top: 6px;
}

.sugerencias-ia {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tarjeta-sugerencia {
  padding: 8px 10px;
  background: var(--panel-elevado);
  border: 1px solid var(--borde);
  border-radius: 6px;
  font-size: 12px;
}
.tarjeta-sugerencia strong { display: block; color: var(--acento); margin-bottom: 2px; }
.btn-aplicar-sug {
  margin-top: 4px;
  font-size: 11px;
  padding: 2px 8px;
  min-height: 28px;
}

/* ==========================================================================
   8. SECCIÓN CAPAS / RECUADROS
   ========================================================================== */
.inspector-seleccion {
  padding: 10px;
  border-radius: 8px;
  background: #ede9e0;
  margin-bottom: 14px;
}
.ayuda-seleccion { margin: 0; font-size: 12px; color: var(--suave); }
.caja-activa-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.caja-activa-info strong { font-size: 13px; }
.fila-ajuste-recuadro {
  display: flex;
  gap: 6px;
}
.fila-ajuste-recuadro button { flex: 1; min-height: 34px; font-size: 12px; }

.bloque-cajas-reticula h3 { margin: 0 0 8px; font-size: 13.5px; }
.lista-cajas-reticula {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.item-caja-reticula {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--borde);
  background: var(--panel-elevado);
  font-size: 12.5px;
}
.item-caja-reticula.activa {
  border-color: var(--acento);
  background: var(--acento-suave);
}
.num-caja {
  font-weight: 700;
  color: var(--acento);
  min-width: 18px;
}
.nombre-caja-img {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.acciones-caja {
  display: flex;
  gap: 2px;
}
.btn-caja-mini {
  padding: 2px 6px;
  min-height: 28px;
  border: 1px solid var(--borde);
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
}
.btn-caja-mini:hover { background: #ede9e0; }

/* ==========================================================================
   9. ÁREA DEL LIENZO
   ========================================================================== */
.area-lienzo {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: #e9e5dc;
}

/* Tira de estilos rápida superior (estilo ArchiPT) */
.tira-estilos-rapida {
  height: 48px;
  background: var(--panel);
  border-bottom: 1px solid var(--borde);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-estilo-rapido {
  flex: 0 0 auto;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--borde-fuerte);
  background: var(--panel-elevado);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s ease;
}
.btn-estilo-rapido:hover { border-color: var(--texto); }
.btn-estilo-rapido.activo {
  background: var(--grafito);
  color: #fff;
  border-color: var(--grafito);
}
.punto-estilo {
  width: 10px;
  height: 10px;
  flex: none;
  box-sizing: border-box;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.15);
}

/* Mesa de trabajo con zoom */
.mesa-trabajo {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  cursor: grab;
}
.mesa-trabajo:active { cursor: grabbing; }

.marco-canvas {
  position: relative;
  box-shadow: 0 18px 48px rgba(38,37,31,.25), 0 2px 8px rgba(0,0,0,.08);
  border-radius: 2px;
  background: #fff;
  transition: transform .12s ease-out;
  transform-origin: center center;
  max-width: 100%;
}

#lienzo-lamina {
  display: block;
  cursor: pointer;
  background: #f5f2eb;
  width: 100%;
  height: auto;
}

/* Barra de zoom flotante */
.barra-zoom-flotante {
  position: static;
  flex: none;
  align-self: flex-end;
  margin: 6px 12px;
  background: var(--panel);
  border: 1px solid var(--borde);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,.1);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  z-index: 10;
}
.btn-zoom {
  width: 32px;
  height: 32px;
  min-height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-weight: bold;
  font-size: 16px;
  cursor: pointer;
}
.btn-zoom:hover { background: #ede9e0; }
.nivel-zoom {
  font-size: 12px;
  font-weight: 600;
  padding: 0 6px;
  min-width: 48px;
  text-align: center;
}
.btn-zoom-ajuste {
  border: none;
  background: transparent;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.btn-zoom-ajuste:hover { background: #ede9e0; }

/* ==========================================================================
   10. MODAL / DIÁLOGOS
   ========================================================================== */
.dialogo-modal {
  border: 1px solid var(--borde-fuerte);
  border-radius: 16px;
  padding: 0;
  max-width: 480px;
  width: 90%;
  background: var(--panel-elevado);
  box-shadow: 0 24px 60px rgba(0,0,0,.3);
}
.dialogo-modal::backdrop {
  background: rgba(38,37,31,0.5);
  backdrop-filter: blur(2px);
}
.contenido-dialogo {
  padding: 24px;
}
.contenido-dialogo h2 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 700;
}
.contenido-dialogo p { margin: 0 0 12px; color: var(--suave); }
.contenido-dialogo ul {
  margin: 0 0 20px;
  padding-left: 20px;
  color: var(--texto);
}
.contenido-dialogo li { margin-bottom: 6px; }
.acciones-dialogo {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Notificación flotante */
.notificacion-flotante {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--grafito);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
  z-index: 100;
  animation: aparecerNotif .25s var(--salida);
}
@keyframes aparecerNotif {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

/* ==========================================================================
   11. ADAPTACIÓN PARA MÓVIL Y TABLET (RESPONSIVE)
   ========================================================================== */
@media (max-width: 860px) {
  :root {
    --altura-barra: 50px;
    --ancho-panel: 100%;
  }

  .barra-superior {
    padding: 0 10px;
  }
  .marca-texto, .separador, .etiqueta-estado { display: none; }
  .superior-centro { display: none; } /* En móvil se mueve al panel o tira */

  .aplicacion {
    flex-direction: column-reverse; /* El panel va abajo tipo hoja inferior */
  }

  .panel-lateral {
    width: 100%;
    height: 48vh;
    height: 48dvh;
    border-right: none;
    border-top: 1px solid var(--borde);
    flex-direction: column-reverse;
  }

  .pestanas-nav {
    width: 100%;
    height: 52px;
    flex-direction: row;
    justify-content: space-around;
    padding: 4px;
    border-right: none;
    border-top: 1px solid var(--borde);
  }

  .pestana-btn {
    min-height: 44px;
    height: 44px;
    flex-direction: column;
    gap: 2px;
    font-size: 12px;
    padding: 2px;
  }

  .panel-contenido {
    width: 100%;
    height: calc(100% - 52px);
    padding: 14px;
  }

  .area-lienzo {
    height: 52vh;
    height: 52dvh;
  }

  .mesa-trabajo {
    padding: 12px;
  }

  .barra-zoom-flotante {
    bottom: 10px;
    right: 10px;
    scale: 0.9;
  }
}

/* Navegación y acciones disponibles también en pantallas pequeñas. */
.navegacion-suite { display: flex; align-items: center; gap: 18px; padding: 0 16px; height: 44px; background: var(--panel); border-bottom: 1px solid var(--borde); }
.navegacion-suite a { color: var(--texto); display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; }
.aplicacion { height: calc(100dvh - var(--altura-barra) - 44px); }
.lista-zonas { display: grid; gap: 8px; margin-bottom: 20px; }
.lista-zonas button { text-align: left; white-space: normal; overflow-wrap: anywhere; }
#selector-imagen { width: 100%; min-height: 44px; }
#btn-cargar-ejemplo, #btn-borrar-datos { margin-top: 12px; }
.tarjeta-sugerencia { overflow-wrap: anywhere; }
.tarjeta-sugerencia p { color: var(--suave); margin: 8px 0; }
.notificacion-flotante { max-width: calc(100vw - 24px); width: max-content; border-radius: 12px; }
@media (max-width: 860px) {
  :root { --altura-barra: 104px; }
  .barra-superior { flex-wrap: wrap; gap: 4px; align-content: center; }
  .superior-centro { display: flex; order: 3; width: 100%; justify-content: center; }
  .superior-izq, .superior-der { gap: 6px; }
  .superior-der .btn-secundario { font-size: 12px; padding-inline: 8px; }
  .navegacion-suite { gap: 16px; padding-inline: 10px; }
  .panel-lateral { height: 52%; min-height: 0; flex-shrink: 0; }
  .area-lienzo { height: 48%; min-height: 0; }
  .mesa-trabajo { min-height: 0; }
  .btn-icono, .btn-caja-mini { min-width: 44px; min-height: 44px; }
  .acciones-dialogo { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  .notificacion-flotante { animation: none; }
}

/* Bandeja del visor: miniaturas seleccionables con los controles del editor. */
#dialogo-visor-info { width: min(760px, calc(100% - 32px)); max-height: 85dvh; overflow: auto; }
.bandeja-grupo { margin-block: 24px; min-width: 0; border: 0; padding: 0; }
.bandeja-grupo legend { font-weight: 600; overflow-wrap: anywhere; }
.bandeja-imagenes { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 16px; margin-top: 12px; }
.bandeja-opcion { display: grid; gap: 8px; cursor: pointer; overflow-wrap: anywhere; padding: 8px; border: 1px solid var(--borde, #ccc7bc); border-radius: 12px; }
.bandeja-opcion:has(input:checked) { outline: 2px solid currentColor; }
.bandeja-opcion img { width: 100%; height: 110px; object-fit: contain; background: #fff; }
.bandeja-opcion input { width: 20px; height: 20px; }
#bandeja-estado { min-height: 2em; }

/* Los cuatro formatos conservan acceso por teclado en pantallas angostas. */
.grupo-formato { max-width:100%; overflow-x:auto; }
.btn-formato { white-space:nowrap; flex-shrink:0; }
@media (max-width:860px) {
  .superior-centro { min-width:0; }
  .grupo-formato { width:100%; }
}

/* La barra ocupa su altura real; navegación y editor nunca se superponen. */
body { display: flex; flex-direction: column; }
.barra-superior, .navegacion-suite { flex: none; }
.aplicacion { flex: 1; min-height: 0; height: auto; }
.area-lienzo { min-width: 0; }
@media (max-width: 860px) {
  .barra-superior { height: auto; min-height: var(--altura-barra); padding-block: 6px; }
  .superior-centro { overflow: hidden; flex: 0 0 100%; }
  .grupo-formato { justify-content: flex-start; }
  .btn-estilo-rapido { min-height: 44px; }
}

#btn-cargar-ejemplo { margin: 0 0 12px; }

/* Colocar imágenes arrastrando (15-nov): miniaturas → recuadros y recuadro ↔ recuadro */
.bloque-lista-imagenes { margin: 0 0 16px; }
.ayuda-arrastre { margin: 0 0 8px; font-size: 12px; line-height: 1.4; color: var(--suave); }
.item-material[draggable="true"] { cursor: grab; }
.item-material.arrastrando { opacity: .45; }
#lienzo-lamina.soltar-aqui { outline: 3px dashed var(--acento); outline-offset: 4px; }
#lienzo-lamina.moviendo-recuadro { cursor: grabbing; }
/* Con material propio, la caja de subida se compacta para no estorbar */
/* Barra del recuadro seleccionado y selector con miniaturas (informe G41: tocar y reemplazar, también en teléfono) */
.barra-recuadro { position: absolute; display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: rgba(38, 37, 31, .92); box-shadow: 0 6px 18px rgba(0,0,0,.25); transform: translate(8px, 8px); z-index: 3; max-width: calc(100% - 16px); flex-wrap: wrap; }
.barra-recuadro[hidden] { display: none; }
.barra-recuadro button { min-height: 36px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: #fff; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.barra-recuadro button:hover, .barra-recuadro button:focus-visible { background: rgba(255,255,255,.16); }
.rejilla-cambiar-imagen { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; margin: 12px 0; max-height: 55vh; overflow: auto; }
.rejilla-cambiar-imagen button { display: grid; gap: 4px; padding: 6px; border: 1px solid var(--borde); border-radius: 10px; background: var(--panel-elevado); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.rejilla-cambiar-imagen button:hover, .rejilla-cambiar-imagen button:focus-visible { border-color: var(--acento); }
.rejilla-cambiar-imagen img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: #e6e1d6; }
.rejilla-cambiar-imagen span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 700px) { .barra-recuadro button { min-height: 44px; } }
.caja-subida.compacta { padding: 10px 12px; gap: 4px; }
.caja-subida.compacta .icono-subida, .caja-subida.compacta > span, .caja-subida.compacta .nota-segura { display: none; }

/* Teléfono (informe G41): la lámina manda; ocupa casi todo el ancho y el panel queda debajo */
@media (max-width: 600px) {
  .panel-lateral { height: 42%; }
  .area-lienzo { height: 58%; }
  .mesa-trabajo { padding: 6px; }
  .tira-estilos-rapida { height: 42px; }
  .barra-recuadro { transform: translate(4px, 4px); }
  .barra-recuadro button { padding: 0 10px; font-size: 12px; }
}

.ayuda-tactil { display: none; }
@media (hover: none) and (pointer: coarse) {
  .ayuda-raton { display: none; }
  .ayuda-tactil { display: inline; }
}

/* Revisión A45 + w111 (15-nov) */
.btn-agregar-rapido { width: 100%; margin: 0 0 10px; }
.mas-opciones-material { margin: 4px 0 14px; }
.mas-opciones-material summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--suave); min-height: 36px; display: flex; align-items: center; }
.mas-opciones-material[open] summary { margin-bottom: 6px; }
.mas-opciones-material .btn-secundario { width: 100%; margin-top: 6px; }
#lienzo-lamina.colocando { cursor: copy; }
.item-material.colocando { border-color: var(--acento); box-shadow: 0 0 0 2px var(--acento); }
.notificacion-flotante .accion-aviso { margin-left: 12px; padding: 4px 10px; min-height: 32px; border: 1px solid rgba(255,255,255,.6); border-radius: 999px; background: transparent; color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
@media (max-width: 860px) {
  .notificacion-flotante { bottom: 76px; }
}
@media (max-width: 600px) {
  /* La barra del recuadro va abajo al centro de la lámina: con «left %» se salía del borde */
  .barra-recuadro { left: 50% !important; top: auto !important; bottom: 6px; transform: translateX(-50%); flex-wrap: nowrap; max-width: none; }
  .barra-recuadro { gap: 2px; padding: 3px; }
  .barra-recuadro button { padding: 0 8px; }
}

.lamina-tira-flechas {
  --lamina-ancho-flecha: 36px;
  --lamina-color-flecha: var(--texto);
  --lamina-borde-flecha: var(--borde-fuerte);
  --lamina-fondo-tira: var(--panel);
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}
.area-lienzo > .lamina-tira-flechas {
  flex: 0 0 48px;
  height: 48px;
}
.lamina-tira-flechas::before,
.lamina-tira-flechas::after {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 1;
  width: 16px;
  content: "";
  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease;
}
.lamina-tira-flechas::before {
  left: var(--lamina-ancho-flecha);
  background: linear-gradient(to right, var(--lamina-fondo-tira), transparent);
}
.lamina-tira-flechas::after {
  right: var(--lamina-ancho-flecha);
  background: linear-gradient(to left, var(--lamina-fondo-tira), transparent);
}
.lamina-tira-flechas.con-mas-anteriores::before,
.lamina-tira-flechas.con-mas-estilos::after { opacity: 1; }
.lamina-tira-flecha {
  position: relative;
  z-index: 2;
  display: grid;
  flex: 0 0 var(--lamina-ancho-flecha);
  width: var(--lamina-ancho-flecha);
  height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid var(--lamina-borde-flecha);
  border-radius: 50%;
  background: var(--lamina-fondo-tira);
  color: var(--lamina-color-flecha);
  font: inherit;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.lamina-tira-flecha:hover:not(:disabled) { border-color: var(--texto); }
.lamina-tira-flecha:focus-visible { outline: 2px solid var(--acento); outline-offset: 2px; }
.lamina-tira-flecha:disabled { opacity: .38; cursor: default; }
.lamina-tira-contenido {
  flex: 1 1 auto;
  min-width: 0;
}
.tira-estilos-rapida.lamina-tira-contenido {
  width: auto;
  height: 100%;
  -webkit-overflow-scrolling: touch;
}
.inicio-activo .area-lienzo > .lamina-tira-flechas { display: none; }
.tira-fichas-estilos.lamina-tira-contenido { padding-inline: 10px; }
@media (max-width: 600px) {
  .area-lienzo > .lamina-tira-flechas { flex-basis: 48px; }
  .tira-estilos-rapida.lamina-tira-contenido { height: 48px; }
}
@media (hover: none) and (pointer: coarse) {
  .lamina-tira-flechas { --lamina-ancho-flecha: 44px; }
  .lamina-tira-flecha { height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .lamina-tira-flechas::before,
  .lamina-tira-flechas::after { transition: none; }
}
