/* Contenedor responsivo */
.tabla-responsive-iautomatika {
  width: 100%;
  overflow-x: auto;
}

/* Tabla base */
.tabla-iautomatika {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border: 1px solid #e6e8eb;
  border-radius: 10px;
  font-size: 14px;
}

/* Cabecera */
.tabla-iautomatika thead th-iautomatika,
.tabla-iautomatika thead th {
  background: #f7f8fa;
  color: #111827;
  text-align: left;
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid #e6e8eb;
  position: sticky;
  top: 0;
  z-index: 1;
}

/* Celdas */
.tabla-iautomatika td-iautomatika,
.tabla-iautomatika td {
  padding: 12px 14px;
  border-bottom: 1px solid #f0f2f5;
  vertical-align: middle;
  color: #111827;
}

/* Zebra */
.tabla-iautomatika tbody tr:nth-child(odd) {
  background: #fafbfc;
}

/* Hover */
.tabla-iautomatika tbody tr:hover {
  background: #eef6ff;
}

/* Esquinas redondeadas */
.tabla-iautomatika thead tr:first-child th:first-child {
  border-top-left-radius: 10px;
}
.tabla-iautomatika thead tr:first-child th:last-child {
  border-top-right-radius: 10px;
}
.tabla-iautomatika tbody tr:last-child td:first-child {
  border-bottom-left-radius: 10px;
}
.tabla-iautomatika tbody tr:last-child td:last-child {
  border-bottom-right-radius: 10px;
}

/* Select dentro de la tabla (select2 o nativo) */
.tabla-iautomatika select,
.tabla-iautomatika .select2-container--default .select2-selection--single {
  width: 100% !important;
  min-width: 240px;
  height: 38px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #fff;
}
.tabla-iautomatika .select2-container--default .select2-selection--single {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  box-sizing: border-box;
  height: 38px;
}
.tabla-iautomatika .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 28px;
}
.tabla-iautomatika .select2-container--default .select2-selection--single .select2-selection__arrow {
  height: 36px;
}

/* Mensaje vacío */
.mensaje-vacio-iautomatika {
  display: none;
  margin-top: 10px;
  color: #6b7280;
  font-size: 14px;
}

/* Ayuda arriba de la tabla */
.ayuda-iautomatika {
  margin-bottom: 8px;
  color: #374151;
  font-size: 14px;
}

/* Responsive columnas en pantallas estrechas */
@media (max-width: 640px) {
  .tabla-iautomatika td,
  .tabla-iautomatika th { padding: 10px 12px; font-size: 13px; }
  .tabla-iautomatika select { min-width: 200px; }
  .tabla-correccion-iautomatika .col-num{
    width: 88px;
    min-width: 88px;
  }
}

/* ========== Corrección: tabla con columnas equilibradas ========== */
.tabla-correccion-iautomatika {
  table-layout: fixed;      /* columnas de ancho similar automáticamente */
}
.tabla-correccion-iautomatika th,
.tabla-correccion-iautomatika td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* Nº de pedido más ancho para que quepa el "name" (#74107, etc.) */
.tabla-correccion-iautomatika .col-num{
  width: 110px;      /* desktop */
  min-width: 100px;  /* evita que table-layout: fixed la encoja */
  text-align: center;
}

/* Botón editar en la celda de domicilio */
.btn-editar-domicilio-ia {
  padding: 8px 14px;
  font-weight: 700;
  font-size: 13px;
  border-radius: var(--iauto-radius, 10px);
  border: 0;
  background: var(--iauto-primary, #2563eb);
  color: #fff;
  box-shadow: 0 3px 8px color-mix(in srgb, var(--iauto-primary) 35%, transparent);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn-editar-domicilio-ia:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px color-mix(in srgb, var(--iauto-primary) 50%, transparent);
}

/* Estado (X / check) */
.estado-domi-iautomatika {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-right: 10px;
  border-radius: 50%;
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
  border: 2px solid transparent;
}
.estado-domi-iautomatika.is-bad {
  color: #ff5b5b;
  border-color: rgba(255, 91, 91, .35);
  background: rgba(255, 91, 91, .08);
}
.estado-domi-iautomatika.is-ok {
  color: #1fa773;
  border-color: rgba(31, 167, 115, .35);
  background: rgba(31, 167, 115, .08);
}

/* ========== Modal estilo sweetalert-like ========== */
.iauto-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, .45);
  backdrop-filter: blur(1.5px);
  z-index: 9998;
}

.iauto-modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 9999;
}

.iauto-modal .iauto-modal-head,
.iauto-modal .iauto-modal-body {
  background: #fff;
}

.iauto-modal > .iauto-modal-head,
.iauto-modal > .iauto-modal-body {
  border-radius: 14px;
}

/* Caja del modal */
.iauto-modal {
  pointer-events: none; /* sólo la tarjeta recibe eventos */
}
.iauto-modal .iauto-modal-body {
  pointer-events: auto;
  width: min(720px, 92vw);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,.20);
  overflow: hidden;
}

/* Cabecera */
.iauto-modal-head {
  pointer-events: auto;
  width: min(720px, 92vw);
  padding: 14px 16px;
  border-radius: 14px 14px 0 0;
  background: #f7f8fa;
  border: 1px solid #e6e8eb;
  border-bottom: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.iauto-modal-title {
  font-weight: 800;
  font-size: 16px;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 10px;
}
.icono-x-iautomatika { color: #ff5b5b; font-weight: 900; }

/* Cuerpo */
.iauto-modal-body {
  border: 1px solid #e6e8eb;
  padding: 18px;
}

/* Botón cerrar */
.iauto-modal-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid #e6e8eb;
  background: #fff;
  color: #111827;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.iauto-modal-close:hover {
  background: #f1f5f9;
}

/* Dirección mala (encabezado del modal) */
.iauto-bad-address {
  padding: 12px 14px;
  margin-bottom: 14px;
  border: 1px dashed #f2a1a1;
  background: #fff5f5;
  color: #8a1f1f;
  border-radius: 10px;
  font-weight: 600;
}

/* Botón “Cancelar” estilo secundario */
.iauto-btn-secundario {
  padding: 9px 16px;
  border-radius: var(--iauto-radius, 10px);
  background: #f3f4f6;
  color: #111827;
  border: 1px solid #e6e8eb;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease;
}
.iauto-btn-secundario:hover { background: #e9eaee; }

/* Ajuste responsive modal */
@media (max-width: 560px) {
  .iauto-modal-head { padding: 12px 14px; }
  .iauto-modal-body { padding: 14px; }
}

